org.apache.ignite.internal.binary

## Class BinaryArray

- java.lang.Object
- - org.apache.ignite.internal.binary.BinaryArray

All Implemented Interfaces:
  Externalizable, Serializable, Cloneable, Comparable<BinaryArray>, BinaryObject, BinaryObjectEx

Direct Known Subclasses:
  BinaryEnumArray

    public class BinaryArray
    extends Object
    implements BinaryObjectEx, Externalizable, Comparable<BinaryArray>

Binary object representing array.

See Also:
  Serialized Form

### Field Summary

Fields
`protected Object[]` `arr` Values.
`protected @Nullable String` `compClsName` Type class name.
`protected int` `compTypeId` Type ID.
`protected BinaryContext` `ctx` Context.
`protected Object[]` `deserialized` Deserialized value.
`static boolean` `DFLT_IGNITE_USE_BINARY_ARRAYS` Default value of `IgniteSystemProperties.IGNITE_USE_BINARY_ARRAYS`.

### Constructor Summary

Constructors
Constructor and Description
`BinaryArray()` `Externalizable` support.
`BinaryArray(BinaryContext ctx, int compTypeId, @Nullable String compClsName, Object[] arr)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`Object[]` `array()`
`BinaryObject` `clone()` Copies this binary object.
`int` `compareTo(@NotNull BinaryArray o)`
`String` `componentClassName()`
`int` `componentTypeId()`
`<T> T` `deserialize()` Gets fully deserialized instance of binary object.
`<T> T` `deserialize(ClassLoader ldr)` Gets fully deserialized instance of binary object.
`String` `enumName()` Get name for this enum object.
`int` `enumOrdinal()` Get ordinal for this enum object.
`boolean` `equals(Object o)`
`<F> F` `field(String fieldName)` Gets field value.
`boolean` `hasField(String fieldName)` Checks whether field exists in the object.
`int` `hashCode()`
`static void` `initUseBinaryArrays()` Initialize `USE_BINARY_ARRAYS` value with `IgniteSystemProperties.IGNITE_USE_BINARY_ARRAYS` system property value.
`boolean` `isFlagSet(short flag)` Check if flag set.
`@Nullable BinaryType` `rawType()` Get raw type.
`void` `readExternal(ObjectInput in)`
`int` `size()` Get the size of the object
`BinaryObjectBuilder` `toBuilder()` Creates a new `BinaryObjectBuilder` based on this binary object.
`String` `toString()`
`BinaryType` `type()` Gets type information for this binary object.
`int` `typeId()`
`static boolean` `useBinaryArrays()`
`void` `writeExternal(ObjectOutput out)`

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

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Field Detail

#### DFLT_IGNITE_USE_BINARY_ARRAYS

    public static final boolean DFLT_IGNITE_USE_BINARY_ARRAYS

Default value of `IgniteSystemProperties.IGNITE_USE_BINARY_ARRAYS`.

See Also:
  Constant Field Values

#### ctx

    @GridToStringExclude
    protected BinaryContext ctx

Context.

#### compTypeId

    protected int compTypeId

Type ID.

#### compClsName

    @Nullable
    protected @Nullable String compClsName

Type class name.

#### arr

    @GridToStringInclude(sensitive=true)
    protected Object[] arr

Values.

#### deserialized

    @GridToStringExclude
    protected Object[] deserialized

Deserialized value.

### Constructor Detail

#### BinaryArray

    public BinaryArray()

`Externalizable` support.

#### BinaryArray

    public BinaryArray(BinaryContext ctx,
                       int compTypeId,
                       @Nullable
                       @Nullable String compClsName,
                       Object[] arr)

Parameters:
  `ctx` - Context.
  `compTypeId` - Component type id.
  `compClsName` - Component class name.
  `arr` - Array.

### Method Detail

#### type

    public BinaryType type()
                    throws BinaryObjectException

Gets type information for this binary object.

Specified by:
  `type` in interface `BinaryObject`
Returns:
  Binary object type information.
Throws:
  `BinaryObjectException` - In case of error.

#### rawType

    @Nullable
    public @Nullable BinaryType rawType()
                                           throws BinaryObjectException

Get raw type.

Specified by:
  `rawType` in interface `BinaryObjectEx`
Returns:
  Raw type
Throws:
  `BinaryObjectException` - If failed.

#### deserialize

    public <T> T deserialize()
                      throws BinaryObjectException

Gets fully deserialized instance of binary object.

Specified by:
  `deserialize` in interface `BinaryObject`
Type Parameters:
  `T` - Type of the deserialized object.
Returns:
  Fully deserialized instance of binary object.
Throws:
  `BinaryInvalidTypeException` - If class doesn't exist.
  `BinaryObjectException` - In case of any other error.

#### deserialize

    public <T> T deserialize(ClassLoader ldr)
                      throws BinaryObjectException

Gets fully deserialized instance of binary object. If `ldr` was not specified, configured class loader will be used `IgniteConfiguration.getClassLoader()`.

Specified by:
  `deserialize` in interface `BinaryObject`
Type Parameters:
  `T` - Type of the deserialized object.
Parameters:
  `ldr` - Class loader.
Returns:
  Fully deserialized instance of binary object.
Throws:
  `BinaryInvalidTypeException` - If class doesn't exist.
  `BinaryObjectException` - In case of any other error.

#### array

    public Object[] array()

Returns:
  Underlying array.

#### componentTypeId

    public int componentTypeId()

Returns:
  Component type ID.

#### componentClassName

    public String componentClassName()

Returns:
  Component class name.

#### 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`

#### typeId

    public int typeId()

Specified by:
  `typeId` in interface `BinaryObjectEx`
Returns:
  Type ID.

#### 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`

#### 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.

#### 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.

#### size

    public int size()

Get the size of the object

Specified by:
  `size` in interface `BinaryObject`
Returns:
  Size of the object

#### isFlagSet

    public boolean isFlagSet(short flag)

Check if flag set.

Specified by:
  `isFlagSet` in interface `BinaryObjectEx`
Parameters:
  `flag` - flag to check.
Returns:
  `true` if flag is set, `false` otherwise.

#### field

    public <F> F field(String fieldName)
                throws BinaryObjectException

Gets field value.

Specified by:
  `field` in interface `BinaryObject`
Type Parameters:
  `F` - Type of the field value.
Parameters:
  `fieldName` - Field name.
Returns:
  Field value.
Throws:
  `BinaryObjectException` - In case of any other error.

#### hasField

    public boolean hasField(String fieldName)

Checks whether field exists in the object.

Specified by:
  `hasField` in interface `BinaryObject`
Parameters:
  `fieldName` - Field name.
Returns:
  `True` if field exists.

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### equals

    public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

#### compareTo

    public int compareTo(@NotNull
                         @NotNull BinaryArray o)

Specified by:
  `compareTo` in interface `Comparable<BinaryArray>`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### useBinaryArrays

    public static boolean useBinaryArrays()

Returns:
  `True` if typed arrays should be used, `false` otherwise.

#### initUseBinaryArrays

    public static void initUseBinaryArrays()

Initialize `USE_BINARY_ARRAYS` value with `IgniteSystemProperties.IGNITE_USE_BINARY_ARRAYS` system property value. This method invoked using reflection in tests.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.14.0
Release Date | : September 29 2022