Class BinaryFieldImpl
- java.lang.Object
-
- org.apache.ignite.internal.binary.BinaryFieldImpl
-
- All Implemented Interfaces:
BinaryField,BinaryFieldEx
public class BinaryFieldImpl extends Object implements BinaryFieldEx
Implementation of binary field descriptor.
-
-
Constructor Summary
Constructors Constructor Description BinaryFieldImpl(BinaryContext ctx, int typeId, BinarySchemaRegistry schemas, String fieldName, int fieldId)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanexists(BinaryObject obj)Check whether field exists in the object.intfieldId()intfieldOrder(BinaryObjectExImpl obj)Get relative field offset.Stringname()Get field's name.<F> FreadField(ByteBuffer buf)Reads field value from the given byte buffer.StringtoString()inttypeId()<T> Tvalue(BinaryObject obj)Get field's value from the given object.booleanwriteField(BinaryObject obj, ByteBuffer buf)Writes field value to the given byte buffer.
-
-
-
Constructor Detail
-
BinaryFieldImpl
public BinaryFieldImpl(BinaryContext ctx, int typeId, BinarySchemaRegistry schemas, String fieldName, int fieldId)
Constructor.- Parameters:
ctx- Binary context.typeId- Type ID.schemas- Schemas.fieldName- Field name.fieldId- Field ID.
-
-
Method Detail
-
name
public String name()
Get field's name.- Specified by:
namein interfaceBinaryField- Returns:
- Name.
-
fieldId
public int fieldId()
- Returns:
- Field ID.
-
exists
public boolean exists(BinaryObject obj)
Check whether field exists in the object.- Specified by:
existsin interfaceBinaryField- Parameters:
obj- Object.- Returns:
Trueif exists.
-
value
public <T> T value(BinaryObject obj)
Get field's value from the given object.- Specified by:
valuein interfaceBinaryField- Type Parameters:
T- Type of the field value.- Parameters:
obj- Object.- Returns:
- Value.
-
typeId
public int typeId()
- Specified by:
typeIdin interfaceBinaryFieldEx- Returns:
- Type ID this field relates to.
-
writeField
public boolean writeField(BinaryObject obj, ByteBuffer buf)
Writes field value to the given byte buffer.- Specified by:
writeFieldin interfaceBinaryFieldEx- Parameters:
obj- Object from which the field should be extracted.buf- Buffer to write the field value to.- Returns:
Trueif the value was successfully written,falseif there is not enough space for the field in the buffer.
-
readField
public <F> F readField(ByteBuffer buf)
Reads field value from the given byte buffer.- Specified by:
readFieldin interfaceBinaryFieldEx- Parameters:
buf- Buffer to read value from.- Returns:
- Field value.
-
fieldOrder
public int fieldOrder(BinaryObjectExImpl obj)
Get relative field offset.- Parameters:
obj- Object.- Returns:
- Field offset.
-
-