Class BinaryMetadata

    • Constructor Detail

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