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 Modifier and Type Field Description protected Object[]arrValues.protected @Nullable StringcompClsNameType class name.protected intcompTypeIdType ID.protected BinaryContextctxContext.protected Object[]deserializedDeserialized value.static booleanDFLT_IGNITE_USE_BINARY_ARRAYSDefault value ofIgniteSystemProperties.IGNITE_USE_BINARY_ARRAYS.
-
Constructor Summary
Constructors Constructor Description BinaryArray()Externalizablesupport.BinaryArray(BinaryContext ctx, int compTypeId, @Nullable String compClsName, Object[] arr)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Object[]array()BinaryObjectclone()Copies this binary object.intcompareTo(@NotNull BinaryArray o)StringcomponentClassName()intcomponentTypeId()<T> Tdeserialize()Gets fully deserialized instance of binary object.<T> Tdeserialize(ClassLoader ldr)Gets fully deserialized instance of binary object.StringenumName()Get name for this enum object.intenumOrdinal()Get ordinal for this enum object.booleanequals(Object o)<F> Ffield(String fieldName)Gets field value.booleanhasField(String fieldName)Checks whether field exists in the object.inthashCode()static voidinitUseBinaryArrays()InitializeUSE_BINARY_ARRAYSvalue withIgniteSystemProperties.IGNITE_USE_BINARY_ARRAYSsystem property value.booleanisFlagSet(short flag)Check if flag set.@Nullable BinaryTyperawType()Get raw type.voidreadExternal(ObjectInput in)intsize()Get the size of the objectBinaryObjectBuildertoBuilder()Creates a newBinaryObjectBuilderbased on this binary object.StringtoString()BinaryTypetype()Gets type information for this binary object.inttypeId()static booleanuseBinaryArrays()voidwriteExternal(ObjectOutput out)
-
-
-
Field Detail
-
DFLT_IGNITE_USE_BINARY_ARRAYS
public static final boolean DFLT_IGNITE_USE_BINARY_ARRAYS
Default value ofIgniteSystemProperties.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()
Externalizablesupport.
-
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:
typein interfaceBinaryObject- Returns:
- Binary object type information.
- Throws:
BinaryObjectException- In case of error.
-
rawType
@Nullable public @Nullable BinaryType rawType() throws BinaryObjectException
Get raw type.- Specified by:
rawTypein interfaceBinaryObjectEx- Returns:
- Raw type
- Throws:
BinaryObjectException- If failed.
-
deserialize
public <T> T deserialize() throws BinaryObjectExceptionGets fully deserialized instance of binary object.- Specified by:
deserializein interfaceBinaryObject- 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. Ifldrwas not specified, configured class loader will be usedIgniteConfiguration.getClassLoader().- Specified by:
deserializein interfaceBinaryObject- 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:
clonein interfaceBinaryObject- Overrides:
clonein classObject- Returns:
- Copy of this binary object.
- Throws:
CloneNotSupportedException
-
typeId
public int typeId()
- Specified by:
typeIdin interfaceBinaryObjectEx- Returns:
- Type ID.
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
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.
-
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.
-
size
public int size()
Get the size of the object- Specified by:
sizein interfaceBinaryObject- Returns:
- Size of the object
-
isFlagSet
public boolean isFlagSet(short flag)
Check if flag set.- Specified by:
isFlagSetin interfaceBinaryObjectEx- Parameters:
flag- flag to check.- Returns:
trueif flag is set,falseotherwise.
-
field
public <F> F field(String fieldName) throws BinaryObjectException
Gets field value.- Specified by:
fieldin interfaceBinaryObject- 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:
hasFieldin interfaceBinaryObject- Parameters:
fieldName- Field name.- Returns:
Trueif field exists.
-
compareTo
public int compareTo(@NotNull @NotNull BinaryArray o)- Specified by:
compareToin interfaceComparable<BinaryArray>
-
useBinaryArrays
public static boolean useBinaryArrays()
- Returns:
Trueif typed arrays should be used,falseotherwise.
-
initUseBinaryArrays
public static void initUseBinaryArrays()
InitializeUSE_BINARY_ARRAYSvalue withIgniteSystemProperties.IGNITE_USE_BINARY_ARRAYSsystem property value. This method invoked using reflection in tests.
-
-