Class KeyCacheObjectImpl
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.CacheObjectAdapter
-
- org.apache.ignite.internal.processors.cache.KeyCacheObjectImpl
-
- All Implemented Interfaces:
Externalizable,Serializable,CacheObject,KeyCacheObject,Message
- Direct Known Subclasses:
IgniteCacheOffheapManagerImpl.ExpiredKeyCacheObject,UserKeyCacheObjectImpl
public class KeyCacheObjectImpl extends CacheObjectAdapter implements KeyCacheObject
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.ignite.internal.processors.cache.CacheObjectAdapter
HEAD_SIZE, val, valBytes
-
Fields inherited from interface org.apache.ignite.internal.processors.cache.CacheObject
TYPE_BINARY, TYPE_BINARY_ENUM, TYPE_BYTE_ARR, TYPE_REGULAR
-
Fields inherited from interface org.apache.ignite.plugin.extensions.communication.Message
DIRECT_TYPE_SIZE
-
-
Constructor Summary
Constructors Constructor Description KeyCacheObjectImpl()KeyCacheObjectImpl(Object val, byte[] valBytes, int part)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KeyCacheObjectcopy(int part)shortdirectType()Gets message type.booleanequals(Object obj)bytefieldsCount()Gets fields count.voidfinishUnmarshal(CacheObjectValueContext ctx, ClassLoader ldr)inthashCode()booleaninternal()booleanisPlatformType()Gets flag indicating whether object value is a platform type.voidonAckReceived()Method called when ack message received.intpartition()voidpartition(int part)Sets partition ID for this key.CacheObjectprepareForCache(CacheObjectContext ctx)Prepares cache object for cache (e.g. copies user-provided object if needed).voidprepareMarshal(CacheObjectValueContext ctx)booleanreadFrom(ByteBuffer buf, MessageReader reader)Reads this message from provided byte buffer.StringtoString()<T> Tvalue(CacheObjectValueContext ctx, boolean cpy)<T> Tvalue(CacheObjectValueContext ctx, boolean cpy, ClassLoader ldr)Deserializes a value from an internal representation.byte[]valueBytes(CacheObjectValueContext ctx)booleanwriteTo(ByteBuffer buf, MessageWriter writer)Writes this message to provided byte buffer.-
Methods inherited from class org.apache.ignite.internal.processors.cache.CacheObjectAdapter
cacheObjectType, needCopy, objectPutSize, putValue, putValue, putValue, putValue, putValue, putValue, readExternal, valueBytesFromValue, valueBytesLength, valueFromValueBytes, writeExternal
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.internal.processors.cache.CacheObject
cacheObjectType, putValue, putValue, putValue, valueBytesLength
-
-
-
-
Constructor Detail
-
KeyCacheObjectImpl
public KeyCacheObjectImpl()
-
KeyCacheObjectImpl
public KeyCacheObjectImpl(Object val, byte[] valBytes, int part)
- Parameters:
val- Value.valBytes- Value bytes.part- Partition.
-
-
Method Detail
-
copy
public KeyCacheObject copy(int part)
- Specified by:
copyin interfaceKeyCacheObject- Parameters:
part- Partition ID.- Returns:
- Copy of this object with given partition set.
-
partition
public int partition()
- Specified by:
partitionin interfaceKeyCacheObject- Returns:
- Partition ID for this key or -1 if it is unknown.
-
partition
public void partition(int part)
Sets partition ID for this key.- Specified by:
partitionin interfaceKeyCacheObject- Parameters:
part- Partition ID.
-
valueBytes
public byte[] valueBytes(CacheObjectValueContext ctx) throws IgniteCheckedException
- Specified by:
valueBytesin interfaceCacheObject- Parameters:
ctx- Context.- Returns:
- Value bytes.
- Throws:
IgniteCheckedException- If failed.
-
internal
public boolean internal()
- Specified by:
internalin interfaceKeyCacheObject- Returns:
Trueif internal cache key.
-
isPlatformType
public boolean isPlatformType()
Gets flag indicating whether object value is a platform type. Platform types will be automatically deserialized on public API cache operations regardless whetherIgniteCache.withKeepBinary()is used or not.- Specified by:
isPlatformTypein interfaceCacheObject- Returns:
- Platform type flag.
-
value
@Nullable public <T> T value(CacheObjectValueContext ctx, boolean cpy)
- Specified by:
valuein interfaceCacheObject- Parameters:
ctx- Context.cpy- Iftrueneed to copy value.- Returns:
- Value.
-
value
@Nullable public <T> T value(CacheObjectValueContext ctx, boolean cpy, ClassLoader ldr)
Deserializes a value from an internal representation.- Specified by:
valuein interfaceCacheObject- Parameters:
ctx- Context.cpy- Iftrueneed to copy value.ldr- Class loader, if it isnull, default class loader will be used.- Returns:
- Value.
-
onAckReceived
public void onAckReceived()
Method called when ack message received.- Specified by:
onAckReceivedin interfaceMessage
-
prepareForCache
public CacheObject prepareForCache(CacheObjectContext ctx)
Prepares cache object for cache (e.g. copies user-provided object if needed).- Specified by:
prepareForCachein interfaceCacheObject- Parameters:
ctx- Cache context.- Returns:
- Instance to store in cache.
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceKeyCacheObject- Overrides:
hashCodein classObject- Returns:
- Key hash code.
-
directType
public short directType()
Gets message type.- Specified by:
directTypein interfaceMessage- Returns:
- Message type.
-
fieldsCount
public byte fieldsCount()
Gets fields count.- Specified by:
fieldsCountin interfaceMessage- Overrides:
fieldsCountin classCacheObjectAdapter- Returns:
- Fields count.
-
readFrom
public boolean readFrom(ByteBuffer buf, MessageReader reader)
Reads this message from provided byte buffer.- Specified by:
readFromin interfaceMessage- Overrides:
readFromin classCacheObjectAdapter- 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:
writeToin interfaceMessage- Overrides:
writeToin classCacheObjectAdapter- Parameters:
buf- Byte buffer.writer- Writer.- Returns:
- Whether message was fully written.
-
prepareMarshal
public void prepareMarshal(CacheObjectValueContext ctx) throws IgniteCheckedException
- Specified by:
prepareMarshalin interfaceCacheObject- Parameters:
ctx- Context.- Throws:
IgniteCheckedException- If failed.
-
finishUnmarshal
public void finishUnmarshal(CacheObjectValueContext ctx, ClassLoader ldr) throws IgniteCheckedException
- Specified by:
finishUnmarshalin interfaceCacheObject- Parameters:
ctx- Context.ldr- Class loader.- Throws:
IgniteCheckedException- If failed.
-
toString
public String toString()
- Overrides:
toStringin classCacheObjectAdapter
-
-