Class BinaryFieldImpl

    • 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:
        name in interface BinaryField
        Returns:
        Name.
      • fieldId

        public int fieldId()
        Returns:
        Field ID.
      • exists

        public boolean exists​(BinaryObject obj)
        Check whether field exists in the object.
        Specified by:
        exists in interface BinaryField
        Parameters:
        obj - Object.
        Returns:
        True if exists.
      • value

        public <T> T value​(BinaryObject obj)
        Get field's value from the given object.
        Specified by:
        value in interface BinaryField
        Type Parameters:
        T - Type of the field value.
        Parameters:
        obj - Object.
        Returns:
        Value.
      • typeId

        public int typeId()
        Specified by:
        typeId in interface BinaryFieldEx
        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:
        writeField in interface BinaryFieldEx
        Parameters:
        obj - Object from which the field should be extracted.
        buf - Buffer to write the field value to.
        Returns:
        True if the value was successfully written, false if 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:
        readField in interface BinaryFieldEx
        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.