org.apache.ignite.internal.binary

## 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 and Description
`BinaryObjectExImpl()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`abstract byte[]` `array()`
`BinaryObject` `clone()` Copies this binary object.
`abstract BinaryContext` `context()` Get binary context.
`abstract BinarySerializedFieldComparator` `createFieldComparator()` Create field comparer.
`abstract BinarySchema` `createSchema()` Create schema for object.
`abstract int` `dataStartOffset()` Get offset of data begin.
`String` `enumName()` Get name for this enum object.
`int` `enumOrdinal()` Get ordinal for this enum object.
`boolean` `equals(Object other)`
`protected abstract <F> F` `field(BinaryReaderHandles ctx, String fieldName)`
`abstract <F> F` `field(int fieldId)` Gets field value.
`abstract <F> F` `fieldByOrder(int order)` Get field by offset.
`abstract int` `footerStartOffset()` Get offset of the footer begin.
`abstract boolean` `hasArray()`
`abstract boolean` `hasSchema()`
`abstract int` `length()`
`abstract long` `offheapAddress()`
`abstract int` `schemaId()` Get schema ID.
`abstract int` `start()`
`BinaryObjectBuilder` `toBuilder()` Creates a new `BinaryObjectBuilder` based on this binary object.
`String` `toString()`
`protected abstract boolean` `writeFieldByOrder(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.internal.binary.BinaryObjectEx

`isFlagSet, rawType, typeId`

### Methods inherited from interface org.apache.ignite.binary.BinaryObject

`deserialize, field, hasField, type`

### Constructor Detail

#### BinaryObjectExImpl

    public BinaryObjectExImpl()

### Method Detail

#### length

    public abstract int length()

Returns:
  Length.

#### start

    public abstract int start()

Returns:
  Object start.

#### hasArray

    public abstract boolean hasArray()

Returns:
  `True` if 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 BinaryObjectException

Gets field value.

Parameters:
  `fieldId` - Field ID.
Returns:
  Field value.
Throws:
  `BinaryObjectException` - In case of any other error.

#### enumOrdinal

    public int enumOrdinal()
                    throws BinaryObjectException

Get ordinal for this enum object. Use `BinaryType.isEnum()` to check if object is of enum type.

Specified by:
  `enumOrdinal` in interface `BinaryObject`
Returns:
  Ordinal.
Throws:
  `BinaryObjectException` - If object is not enum.

#### enumName

    public String enumName()
                    throws BinaryObjectException

Get name for this enum object. Use `BinaryType.isEnum()` to check if object is of enum type.

Specified by:
  `enumName` in interface `BinaryObject`
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 comparer.

Returns:
  Comparer.

#### 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, `false` if 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:
  `True` if 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 new `BinaryObjectBuilder` based on this binary object. The following code

     BinaryObjectBuilder builder = binaryObject.toBuilder();

is equivalent to

     BinaryObjectBuilder builder = ignite.binary().builder(binaryObject);

Specified by:
  `toBuilder` in interface `BinaryObject`
Returns:
  Binary object builder.
Throws:
  `BinaryObjectException` - If builder cannot be created.

#### clone

    public BinaryObject clone()
                       throws CloneNotSupportedException

Copies this binary object.

Specified by:
  `clone` in interface `BinaryObject`
Overrides:
  `clone` in class `Object`
Returns:
  Copy of this binary object.
Throws:
  `CloneNotSupportedException`

#### equals

    public boolean equals(Object other)

Overrides:
  `equals` in class `Object`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.4.0
Release Date | : March 5 2018