Class DataBuilder

  • All Implemented Interfaces:

    
    public final class DataBuilder
    
                        

    Builder class to create instances of the Data type

    Since:

    2.0

    • Constructor Detail

      • DataBuilder

        DataBuilder()
    • Method Detail

      • tag

         final DataBuilder tag(Tag tag)

        Sets the Tag and DataType to use. See Tag.type.

        Parameters:
        tag - The Tag to be used
        Returns:

        this reference

        Since:

        2.0

      • raw

         final DataBuilder raw(ByteArray value, Byte type)

        Sets the raw data without type safety.

        Parameters:
        value - Raw data
        type - Data type to be set.
        Returns:

        this reference

        Since:

        2.0

      • timestamp

         final DataBuilder timestamp(Instant timestamp)

        Sets the value as timestamp and the data type to DataType.TIMESTAMP.

        Parameters:
        timestamp - Value to be set
        Returns:

        this reference

        Since:

        2.0

      • timestamp

         final DataBuilder timestamp(Duration timestamp)

        Sets the value as timestamp and the data type to DataType.TIMESTAMP.

        Parameters:
        timestamp - Value to be set
        Returns:

        this reference

        Since:

        2.0

      • none

         final DataBuilder none()

        Sets an empty ByteArray as value and the data type DataType.NONE.

        Returns:

        this reference

        Since:

        2.0

      • bool

         final DataBuilder bool(Boolean value)

        Sets the value as Boolean and the data type to DataType.BOOL.

        Parameters:
        value - Value to be set
        Returns:

        this reference

        Since:

        2.0

      • char8

         final DataBuilder char8(Byte value)

        Sets the value as Byte and the data type to DataType.CHAR8.

        Parameters:
        value - Value to be set
        Returns:

        this reference

        Since:

        2.0

      • uchar8

         final DataBuilder uchar8(Byte value)

        Sets the value as Byte and the data type to DataType.UCHAR8.

        Parameters:
        value - Value to be set
        Returns:

        this reference

        Since:

        2.0

      • int16

         final DataBuilder int16(Short value)

        Sets the value as Short and the data type to DataType.INT16.

        Parameters:
        value - Value to be set
        Returns:

        this reference

        Since:

        2.0

      • uint16

         final DataBuilder uint16(Short value)

        Sets the value as Short and the data type to DataType.UINT16.

        Parameters:
        value - Value to be set
        Returns:

        this reference

        Since:

        2.0

      • int32

         final DataBuilder int32(Integer value)

        Sets the value as Int and the data type to DataType.INT32.

        Parameters:
        value - Value to be set
        Returns:

        this reference

        Since:

        2.0

      • uint32

         final DataBuilder uint32(Integer value)

        Sets the value as Int and the data type to DataType.UINT32.

        Parameters:
        value - Value to be set
        Returns:

        this reference

        Since:

        2.0

      • int64

         final DataBuilder int64(Long value)

        Sets the value as Long and the data type to DataType.INT64.

        Parameters:
        value - Value to be set
        Returns:

        this reference

        Since:

        2.0

      • uint64

         final DataBuilder uint64(Long value)

        Sets the value as Long and the data type to DataType.UINT64.

        Parameters:
        value - Value to be set
        Returns:

        this reference

        Since:

        2.0

      • float32

         final DataBuilder float32(Float value)

        Sets the value as Float and the data type to DataType.FLOAT32.

        Parameters:
        value - Value to be set
        Returns:

        this reference

        Since:

        2.0

      • double64

         final DataBuilder double64(Double value)

        Sets the value as Double and the data type to DataType.DOUBLE64.

        Parameters:
        value - Value to be set
        Returns:

        this reference

        Since:

        2.0

      • bitfield

         final DataBuilder bitfield(Byte value)

        Sets the value as Byte and the data type to DataType.BITFIELD.

        Parameters:
        value - Value to be set
        Returns:

        this reference

        Since:

        2.0

      • string

         final DataBuilder string(String value)

        Sets the value as String and the data type to DataType.STRING.

        The UTF-8 character set is used to convert the string into a ByteArray.

        Parameters:
        value - Value to be set
        Returns:

        this reference

        Since:

        2.0

      • container

         final DataBuilder container(List<Data> value)

        Sets the value to the ByteArray representation of the passed Data list. The data type is set to DataType.CONTAINER..

        Parameters:
        value - Value to be set
        Returns:

        this reference

        Since:

        2.0

      • container

         final DataBuilder container(Data value)

        Sets the value to the ByteArray representation of the passed Data arguments. The data type is set to DataType.CONTAINER..

        Parameters:
        value - Value to be set
        Returns:

        this reference

        Since:

        2.0

      • bytearray

         final DataBuilder bytearray(ByteArray value)

        Sets the value as ByteArray and the data type to DataType.BYTEARRAY.

        Parameters:
        value - Value to be set
        Returns:

        this reference

        Since:

        2.0

      • build

         final Data build()

        Creates a Data objects based on the configured data.

        Returns:

        Data Object

        Since:

        2.0