Class BinaryObjectExImpl
- java.lang.Object
-
- org.apache.ignite.internal.binary.BinaryObjectExImpl
-
- All Implemented Interfaces:
Serializable,Cloneable,BinaryObject,BinaryObjectEx
- Direct Known Subclasses:
BinaryObjectImpl,BinaryObjectOffheapImpl
public abstract class BinaryObjectExImpl extends Object implements BinaryObjectEx
Internal binary object interface.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BinaryObjectExImpl()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract byte[]array()BinaryObjectclone()Copies this binary object.abstract BinaryContextcontext()Get binary context.abstract BinarySerializedFieldComparatorcreateFieldComparator()Create field comparator.abstract BinarySchemacreateSchema()Create schema for object.abstract intdataStartOffset()Get offset of data begin.StringenumName()Get name for this enum object.intenumOrdinal()Get ordinal for this enum object.booleanequals(Object other)abstract <F> Ffield(int fieldId)Gets field value.protected abstract <F> Ffield(BinaryReaderHandles ctx, String fieldName)abstract <F> FfieldByOrder(int order)Get field by offset.abstract intfooterStartOffset()Get offset of the footer begin.abstract booleanhasArray()booleanhasCircularReferences()Check if object graph has circular references.abstract booleanhasSchema()abstract intlength()abstract longoffheapAddress()abstract intschemaId()Get schema ID.abstract intstart()BinaryObjectBuildertoBuilder()Creates a newBinaryObjectBuilderbased on this binary object.StringtoString()protected abstract booleanwriteFieldByOrder(int fieldOffset, ByteBuffer buf)Writes field value defined by the given field offset to the given byte buffer.-
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.binary.BinaryObject
deserialize, deserialize, field, hasField, size, type
-
Methods inherited from interface org.apache.ignite.internal.binary.BinaryObjectEx
isFlagSet, rawType, typeId
-
-
-
-
Method Detail
-
length
public abstract int length()
- Returns:
- Length.
-
start
public abstract int start()
- Returns:
- Object start.
-
hasArray
public abstract boolean hasArray()
- Returns:
Trueif object is array based.
-
array
public abstract byte[] array()
- Returns:
- Object array if object is array based, otherwise
null.
-
offheapAddress
public abstract long offheapAddress()
- Returns:
- Object offheap address is object is offheap based, otherwise 0.
-
field
@Nullable public abstract <F> F field(int fieldId) throws BinaryObjectExceptionGets field value.- Parameters:
fieldId- Field ID.- Returns:
- Field value.
- Throws:
BinaryObjectException- In case of any other error.
-
enumOrdinal
public int enumOrdinal() throws BinaryObjectExceptionGet ordinal for this enum object. UseBinaryType.isEnum()to check if object is of enum type.- Specified by:
enumOrdinalin interfaceBinaryObject- Returns:
- Ordinal.
- Throws:
BinaryObjectException- If object is not enum.
-
enumName
public String enumName() throws BinaryObjectException
Get name for this enum object. UseBinaryType.isEnum()to check if object is of enum type.- Specified by:
enumNamein interfaceBinaryObject- Returns:
- Name.
- Throws:
BinaryObjectException- If object is not enum.
-
dataStartOffset
public abstract int dataStartOffset()
Get offset of data begin.- Returns:
- Field value.
-
footerStartOffset
public abstract int footerStartOffset()
Get offset of the footer begin.- Returns:
- Field value.
-
fieldByOrder
@Nullable public abstract <F> F fieldByOrder(int order)
Get field by offset.- Parameters:
order- Field offset.- Returns:
- Field value.
-
createFieldComparator
public abstract BinarySerializedFieldComparator createFieldComparator()
Create field comparator.- Returns:
- Comparator.
-
writeFieldByOrder
protected abstract boolean writeFieldByOrder(int fieldOffset, ByteBuffer buf)Writes field value defined by the given field offset to the given byte buffer.- Parameters:
fieldOffset- Field offset.- Returns:
- Boolean flag indicating whether the field was successfully written to the buffer,
falseif there is no enough space for the field in the buffer.
-
field
@Nullable protected abstract <F> F field(BinaryReaderHandles ctx, String fieldName)
- Parameters:
ctx- Reader context.fieldName- Field name.- Returns:
- Field value.
-
hasSchema
public abstract boolean hasSchema()
- Returns:
Trueif object has schema.
-
schemaId
public abstract int schemaId()
Get schema ID.- Returns:
- Schema ID.
-
createSchema
public abstract BinarySchema createSchema()
Create schema for object.- Returns:
- Schema.
-
context
public abstract BinaryContext context()
Get binary context.- Returns:
- Binary context.
-
toBuilder
public BinaryObjectBuilder toBuilder() throws BinaryObjectException
Creates a newBinaryObjectBuilderbased on this binary object. The following codeBinaryObjectBuilder builder = binaryObject.toBuilder();
is equivalent toBinaryObjectBuilder builder = ignite.binary().builder(binaryObject);
- Specified by:
toBuilderin interfaceBinaryObject- Returns:
- Binary object builder.
- Throws:
BinaryObjectException- If builder cannot be created.
-
clone
public BinaryObject clone() throws CloneNotSupportedException
Copies this binary object.- Specified by:
clonein interfaceBinaryObject- Overrides:
clonein classObject- Returns:
- Copy of this binary object.
- Throws:
CloneNotSupportedException
-
hasCircularReferences
public boolean hasCircularReferences()
Check if object graph has circular references.- Returns:
trueif object has circular references.
-
-