Class BinaryMetadata
- java.lang.Object
-
- org.apache.ignite.internal.binary.BinaryMetadata
-
- All Implemented Interfaces:
Externalizable,Serializable
public class BinaryMetadata extends Object implements Externalizable
Binary metadata which is passed over a wire.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BinaryMetadata()ForExternalizable.BinaryMetadata(int typeId, String typeName, @Nullable Map<String,BinaryFieldMetadata> fields, @Nullable String affKeyFieldName, @Nullable Collection<BinarySchema> schemas, boolean isEnum, @Nullable Map<String,Integer> enumMap)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable StringaffinityKeyFieldName()Map<String,Integer>enumMap()Collection<String>fields()Map<String,BinaryFieldMetadata>fieldsMap()@Nullable StringfieldTypeName(String fieldName)StringgetEnumNameByOrdinal(int ord)Gets enum constant name given its ordinal value.IntegergetEnumOrdinalByName(String name)Gets enum constant ordinal value given its name.booleanhasSchema(int schemaId)booleanisEnum()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 readExternal for other objects.Collection<BinarySchema>schemas()StringtoString()inttypeId()StringtypeName()BinaryTypeImplwrap(BinaryContext ctx)Wrap metadata into binary type.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.
-
-
-
Constructor Detail
-
BinaryMetadata
public BinaryMetadata()
ForExternalizable.
-
BinaryMetadata
public BinaryMetadata(int typeId, String typeName, @Nullable @Nullable Map<String,BinaryFieldMetadata> fields, @Nullable @Nullable String affKeyFieldName, @Nullable @Nullable Collection<BinarySchema> schemas, boolean isEnum, @Nullable @Nullable Map<String,Integer> enumMap)Constructor.- Parameters:
typeId- Type ID.typeName- Type name.fields- Fields map.affKeyFieldName- Affinity key field name.schemas- Schemas.isEnum- Enum flag.enumMap- Enum name to ordinal mapping.
-
-
Method Detail
-
typeId
public int typeId()
- Returns:
- Type ID.
-
typeName
public String typeName()
- Returns:
- Type name.
-
fields
public Collection<String> fields()
- Returns:
- Fields.
-
fieldsMap
public Map<String,BinaryFieldMetadata> fieldsMap()
- Returns:
- Fields.
-
fieldTypeName
@Nullable public @Nullable String fieldTypeName(String fieldName)
- Parameters:
fieldName- Field name.- Returns:
- Field type name.
-
affinityKeyFieldName
@Nullable public @Nullable String affinityKeyFieldName()
- Returns:
- Affinity key field name.
-
schemas
public Collection<BinarySchema> schemas()
- Returns:
- Schemas.
-
hasSchema
public boolean hasSchema(int schemaId)
- Parameters:
schemaId- Schema ID.- Returns:
trueif BinaryMetadata instance has schema with ID specified,falseotherwise.
-
isEnum
public boolean isEnum()
- Returns:
Trueif this is enum type.
-
wrap
public BinaryTypeImpl wrap(BinaryContext ctx)
Wrap metadata into binary type.- Parameters:
ctx- Binary context.- Returns:
- Binary type.
-
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 readExternal 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.
-
getEnumNameByOrdinal
public String getEnumNameByOrdinal(int ord)
Gets enum constant name given its ordinal value.- Parameters:
ord- Enum constant ordinal value.- Returns:
- Enum constant name.
-
getEnumOrdinalByName
public Integer getEnumOrdinalByName(String name)
Gets enum constant ordinal value given its name.- Parameters:
name- Enum constant name.- Returns:
- Enum constant ordinal value.
-
-