Class BinarySchema
- java.lang.Object
-
- org.apache.ignite.internal.binary.BinarySchema
-
- All Implemented Interfaces:
Externalizable,Serializable
public class BinarySchema extends Object implements Externalizable
Schema describing binary object content. We rely on the following assumptions: - When amount of fields in the object is low, it is better to inline these values into int fields thus allowing for quick comparisons performed within already fetched L1 cache line. - When there are more fields, we store them inside a hash map.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBinarySchema.BuilderSchema builder.static classBinarySchema.ConfirmationOrder confirmation result.
-
Field Summary
Fields Modifier and Type Field Description static intORDER_NOT_FOUNDOrder returned if field is not found.
-
Constructor Summary
Constructors Constructor Description BinarySchema()Externalizablesupport.BinarySchema(int schemaId, List<Integer> fieldIds)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclarifyFieldName(int order, String name)Add field name.BinarySchema.ConfirmationconfirmOrder(int expOrder, String expName)Try speculatively confirming order for the given field name.booleanequals(Object o)intfieldId(int order)Get field ID by order in footer.int[]fieldIds()Gets field ids array.inthashCode()intorder(int id)Get field order in footer by field ID.voidreadExternal(ObjectInput in)voidreadFrom(DataInput in)The object implements the readFrom method to restore its contents by calling the methods of DataInput for primitive types and strings or calling readFrom for other objects.intschemaId()StringtoString()voidwriteExternal(ObjectOutput out)voidwriteTo(DataOutput out)The object implements the writeTo method to save its contents by calling the methods of DataOutput for its primitive values and strings or calling the writeTo method for other objects.
-
-
-
Field Detail
-
ORDER_NOT_FOUND
public static final int ORDER_NOT_FOUND
Order returned if field is not found.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BinarySchema
public BinarySchema()
Externalizablesupport.
-
-
Method Detail
-
schemaId
public int schemaId()
- Returns:
- Schema ID.
-
confirmOrder
public BinarySchema.Confirmation confirmOrder(int expOrder, String expName)
Try speculatively confirming order for the given field name.- Parameters:
expOrder- Expected order.expName- Expected name.- Returns:
- Field ID.
-
clarifyFieldName
public void clarifyFieldName(int order, String name)Add field name.- Parameters:
order- Order.name- Name.
-
fieldId
public int fieldId(int order)
Get field ID by order in footer.- Parameters:
order- Order.- Returns:
- Field ID.
-
order
public int order(int id)
Get field order in footer by field ID.- Parameters:
id- Field ID.- Returns:
- Offset or
0if there is no such field.
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
writeTo
public void writeTo(DataOutput out) throws IOException
The object implements the writeTo method to save its contents by calling the methods of DataOutput for its primitive values and strings or calling the writeTo method for other objects.- Parameters:
out- the stream to write the object to.- Throws:
IOException- Includes any I/O exceptions that may occur.
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
readFrom
public void readFrom(DataInput in) throws IOException
The object implements the readFrom method to restore its contents by calling the methods of DataInput for primitive types and strings or calling readFrom for other objects. The readFrom method must read the values in the same sequence and with the same types as were written by writeTo.- Parameters:
in- the stream to read data from in order to restore the object- Throws:
IOException- if I/O errors occur
-
fieldIds
public int[] fieldIds()
Gets field ids array.- Returns:
- Field ids.
-
-