org.apache.ignite.internal.processors.cache

## Class CacheObjectAdapter

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.CacheObjectAdapter

All Implemented Interfaces:
  Externalizable, Serializable, CacheObject, Message

Direct Known Subclasses:
  CacheObjectImpl, KeyCacheObjectImpl

    public abstract class CacheObjectAdapter
    extends Object
    implements CacheObject, Externalizable

See Also:
  Serialized Form

### Field Summary

Fields
`protected Object` `val`
`protected byte[]` `valBytes`

### Fields inherited from interface org.apache.ignite.internal.processors.cache.CacheObject

`TYPE_BYTE_ARR, TYPE_REGULAR`

### Constructor Summary

Constructors
Constructor and Description
`CacheObjectAdapter()`

### Method Summary

Methods
`byte` `fieldsCount()` Gets fields count.
`protected boolean` `needCopy(CacheObjectContext ctx)`
`void` `readExternal(ObjectInput in)`
`boolean` `readFrom(ByteBuffer buf, MessageReader reader)` Reads this message from provided byte buffer.
`String` `toString()`
`byte` `type()`
`void` `writeExternal(ObjectOutput out)`
`boolean` `writeTo(ByteBuffer buf, MessageWriter writer)` Writes this message to provided byte buffer.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.apache.ignite.internal.processors.cache.CacheObject

`finishUnmarshal, prepareForCache, prepareMarshal, value, valueBytes`

### Methods inherited from interface org.apache.ignite.plugin.extensions.communication.Message

`directType`

### Field Detail

#### val

    @GridToStringInclude
    protected Object val

#### valBytes

    protected byte[] valBytes

### Constructor Detail

#### CacheObjectAdapter

    public CacheObjectAdapter()

### Method Detail

#### needCopy

    protected boolean needCopy(CacheObjectContext ctx)

Parameters:
  `ctx` - Context.
Returns:
  `True` need to copy value returned to user.

#### type

    public byte type()

Specified by:
  `type` in interface `CacheObject`
Returns:
  Object type.

#### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

Specified by:
  `writeExternal` in interface `Externalizable`
Throws:
  `IOException`

#### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException

Specified by:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`
  `ClassNotFoundException`

#### readFrom

    public boolean readFrom(ByteBuffer buf,
                   MessageReader reader)

Reads this message from provided byte buffer.

Specified by:
  `readFrom` in interface `Message`
Parameters:
  `buf` - Byte buffer.
  `reader` - Reader.
Returns:
  Whether message was fully read.

#### writeTo

    public boolean writeTo(ByteBuffer buf,
                  MessageWriter writer)

Writes this message to provided byte buffer.

Specified by:
  `writeTo` in interface `Message`
Parameters:
  `buf` - Byte buffer.
  `writer` - Writer.
Returns:
  Whether message was fully written.

#### fieldsCount

    public byte fieldsCount()

Gets fields count.

Specified by:
  `fieldsCount` in interface `Message`
Returns:
  Fields count.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.4.0
Release Date | : September 24 2015