fields

## Class DataField

- java.lang.Object
- - fields.DataField

- All Implemented Interfaces:
    Field

      public class DataField
      extends java.lang.Object
      implements Field

  Model for the WM-Bus Data-Field. Keeps one DataHeader and a list of DataRecords.
  Author:
    David Hudec (dwdization@gmail.com)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private DataHeader` | `dataHeader`
    `private java.util.List<DataRecord>` | `dataRecords`
    `private byte[]` | `encryptionIV`
    `private byte[]` | `encryptionKey`
    `private EncryptionMethod` | `encryptionMethod`
    `private java.lang.Byte[]` | `verification`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DataField()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `DataField` | `encrypt(EncryptionMethod method, byte[] iv, byte[] key)` Creates an EncryptedDataField from this one, using given encryption method, encryption key and initialization vector (may be null).
    `java.util.List<java.lang.Byte>` | `getBytes()` Fetches all parts of the field and constructs it into a List of Bytes by WM-Bus standard, MSB first.
    `java.util.List<java.lang.Byte>` | `getBytesInTxOrder()` Fetches all parts of the field and constructs it into a List of Bytes by WM-Bus standard, LSB first.
    `DataHeader` | `getDataHeader()`
    `private java.util.List<java.lang.Byte>` | `getDataRecordBytes()`
    `java.util.List<DataRecord>` | `getDataRecords()`
    `byte[]` | `getEncryptionIV()`
    `byte[]` | `getEncryptionKey()`
    `EncryptionMethod` | `getEncryptionMethod()`
    `java.lang.Byte[]` | `getVerification()`
    `boolean` | `hasPayload()`
    `private DataField` | `setDataHeader(DataHeader dh)`
    `void` | `setEncryptionIV(java.lang.String encryptionIV)`
    `void` | `setEncryptionKey(java.lang.String encryptionKey)`
    `void` | `setEncryptionMethod(EncryptionMethod encryptionMethod)`
    `void` | `setVerification(java.lang.Byte[] verification)`

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

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

- - ### Field Detail

    - #### dataHeader

          private DataHeader dataHeader

    - #### dataRecords

          private java.util.List<DataRecord> dataRecords

    - #### encryptionIV

          private byte[] encryptionIV

    - #### encryptionKey

          private byte[] encryptionKey

    - #### encryptionMethod

          private EncryptionMethod encryptionMethod

    - #### verification

          private java.lang.Byte[] verification

  - ### Constructor Detail

    - #### DataField

          public DataField()

  - ### Method Detail

    - #### encrypt

          public DataField encrypt(EncryptionMethod method,
                                   byte[] iv,
                                   byte[] key)

      Creates an EncryptedDataField from this one, using given encryption method, encryption key and initialization vector (may be null).
      Parameters:
        `method` - encryption method to use
        `iv` - initialization vector to use (may be null)
        `key` - encryption key to use
      Returns:
        EncryptedDataField object, created by encrypting this DataField

    - #### getBytes

          public java.util.List<java.lang.Byte> getBytes()

      Description copied from interface: `Field`
      Fetches all parts of the field and constructs it into a List of Bytes by WM-Bus standard, MSB first.
      Specified by:
        `getBytes` in interface `Field`
      Returns:
        List of Bytes representing this field, MSB first

    - #### getBytesInTxOrder

          public java.util.List<java.lang.Byte> getBytesInTxOrder()

      Description copied from interface: `Field`
      Fetches all parts of the field and constructs it into a List of Bytes by WM-Bus standard, LSB first.
      Specified by:
        `getBytesInTxOrder` in interface `Field`
      Returns:
        List of Bytes representing this field, LSB first

    - #### getDataHeader

          public DataHeader getDataHeader()

    - #### getDataRecordBytes

          private java.util.List<java.lang.Byte> getDataRecordBytes()

    - #### getDataRecords

          public java.util.List<DataRecord> getDataRecords()

    - #### getEncryptionIV

          public byte[] getEncryptionIV()

    - #### getEncryptionKey

          public byte[] getEncryptionKey()

    - #### getEncryptionMethod

          public EncryptionMethod getEncryptionMethod()

    - #### getVerification

          public java.lang.Byte[] getVerification()

    - #### hasPayload

          public boolean hasPayload()

      Returns:
        true if there are any DataRecords in this DataField and at least one of them has non-empty data.

    - #### setDataHeader

          private DataField setDataHeader(DataHeader dh)

    - #### setEncryptionIV

          public void setEncryptionIV(java.lang.String encryptionIV)

    - #### setEncryptionKey

          public void setEncryptionKey(java.lang.String encryptionKey)

    - #### setEncryptionMethod

          public void setEncryptionMethod(EncryptionMethod encryptionMethod)

    - #### setVerification

          public void setVerification(java.lang.Byte[] verification)