Package com.io7m.smfj.processing.api

## Class SMFMetadata

- java.lang.Object
- - com.io7m.smfj.processing.api.SMFMetadata

- All Implemented Interfaces:
    `SMFMetadataType`

      public final class SMFMetadata
      extends java.lang.Object
      implements SMFMetadataType

  Parsed immutable metadata.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `SMFMetadata.Builder` | Builds instances of type `SMFMetadata`.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static SMFMetadata.Builder` | `builder()` | Creates a builder for `SMFMetadata`.
    `static SMFMetadata` | `copyOf​(SMFMetadataType instance)` | Creates an immutable copy of a `SMFMetadataType` value.
    `byte[]` | `data()` |
    `boolean` | `equals​(java.lang.Object another)` | This instance is equal to all instances of `SMFMetadata` that have equal attribute values.
    `int` | `hashCode()` | Computes a hash code from attributes: `schema`, `data`.
    `static SMFMetadata` | `of​(SMFSchemaIdentifier schema, byte[] data)` | Construct a new immutable `SMFMetadata` instance.
    `SMFSchemaIdentifier` | `schema()` |
    `java.lang.String` | `toString()` | Prints the immutable value `SMFMetadata` with attribute values.
    `SMFMetadata` | `withData​(byte... elements)` | Copy the current immutable object with elements that replace the content of `data`.
    `SMFMetadata` | `withSchema​(SMFSchemaIdentifier value)` | Copy the current immutable object by setting a value for the `schema` attribute.

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

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

- - ### Method Detail

    - #### schema

          public SMFSchemaIdentifier schema()

      Specified by:
        `schema` in interface `SMFMetadataType`
      Returns:
        The metadata schema

    - #### data

          public byte[] data()

      Specified by:
        `data` in interface `SMFMetadataType`
      Returns:
        The metadata

    - #### withSchema

          public final SMFMetadata withSchema​(SMFSchemaIdentifier value)

      Copy the current immutable object by setting a value for the `schema` attribute. A shallow reference equality check is used to prevent copying of the same value by returning `this`.
      Parameters:
        `value` - A new value for schema
      Returns:
        A modified copy of the `this` object

    - #### withData

          public final SMFMetadata withData​(byte... elements)

      Copy the current immutable object with elements that replace the content of `data`. The array is cloned before being saved as attribute values.
      Parameters:
        `elements` - The non-null elements for data
      Returns:
        A modified copy of `this` object

    - #### equals

          public boolean equals​(java.lang.Object another)

      This instance is equal to all instances of `SMFMetadata` that have equal attribute values.
      Overrides:
        `equals` in class `java.lang.Object`
      Returns:
        `true` if `this` is equal to `another` instance

    - #### hashCode

          public int hashCode()

      Computes a hash code from attributes: `schema`, `data`.
      Overrides:
        `hashCode` in class `java.lang.Object`
      Returns:
        hashCode value

    - #### toString

          public java.lang.String toString()

      Prints the immutable value `SMFMetadata` with attribute values.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        A string representation of the value

    - #### of

          public static SMFMetadata of​(SMFSchemaIdentifier schema,
                                       byte[] data)

      Construct a new immutable `SMFMetadata` instance.
      Parameters:
        `schema` - The value for the `schema` attribute
        `data` - The value for the `data` attribute
      Returns:
        An immutable SMFMetadata instance

    - #### copyOf

          public static SMFMetadata copyOf​(SMFMetadataType instance)

      Creates an immutable copy of a `SMFMetadataType` value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
        `instance` - The instance to copy
      Returns:
        A copied immutable SMFMetadata instance

    - #### builder

          public static SMFMetadata.Builder builder()

      Creates a builder for `SMFMetadata`.

           SMFMetadata.builder()
              .setSchema(com.io7m.smfj.core.SMFSchemaIdentifier) // required schema
              .setData(byte) // required data
              .build();

      Returns:
        A new SMFMetadata builder