org.apache.ignite.internal.binary

## 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 and Description
`BinaryMetadata()` For `Externalizable`.
`BinaryMetadata(int typeId, String typeName, Map<String,BinaryFieldMetadata> fields, String affKeyFieldName, Collection<BinarySchema> schemas, boolean isEnum, Map<String,Integer> enumMap)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`String` `affinityKeyFieldName()`
`Map<String,Integer>` `enumMap()`
`Collection<String>` `fields()`
`Map<String,BinaryFieldMetadata>` `fieldsMap()`
`String` `fieldTypeName(String fieldName)`
`String` `getEnumNameByOrdinal(int ord)` Gets enum constant name given its ordinal value.
`Integer` `getEnumOrdinalByName(String name)` Gets enum constant ordinal value given its name.
`boolean` `hasSchema(int schemaId)`
`boolean` `isEnum()`
`void` `readExternal(ObjectInput in)`
`void` `readFrom(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()`
`String` `toString()`
`int` `typeId()`
`String` `typeName()`
`BinaryTypeImpl` `wrap(BinaryContext ctx)` Wrap metadata into binary type.
`void` `writeExternal(ObjectOutput out)`
`void` `writeTo(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.

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### BinaryMetadata

    public BinaryMetadata()

For `Externalizable`.

#### BinaryMetadata

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

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 String fieldTypeName(String fieldName)

Parameters:
  `fieldName` - Field name.
Returns:
  Field type name.

#### affinityKeyFieldName

    @Nullable
    public 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:
  `true` if BinaryMetadata instance has schema with ID specified, `false` otherwise.

#### isEnum

    public boolean isEnum()

Returns:
  `True` if 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:
  `writeExternal` in interface `Externalizable`
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:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`
  `ClassNotFoundException`

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

#### enumMap

    public Map<String,Integer> enumMap()

Returns:
  Name to ordinal mapping.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.6
Release Date | : September 11 2019