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 typeSMFMetadata
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SMFMetadata.Builder
builder()
Creates a builder forSMFMetadata
.static SMFMetadata
copyOf(SMFMetadataType instance)
Creates an immutable copy of aSMFMetadataType
value.byte[]
data()
boolean
equals(java.lang.Object another)
This instance is equal to all instances ofSMFMetadata
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 immutableSMFMetadata
instance.SMFSchemaIdentifier
schema()
java.lang.String
toString()
Prints the immutable valueSMFMetadata
with attribute values.SMFMetadata
withData(byte... elements)
Copy the current immutable object with elements that replace the content ofdata
.SMFMetadata
withSchema(SMFSchemaIdentifier value)
Copy the current immutable object by setting a value for theschema
attribute.
-
-
-
Method Detail
-
schema
public SMFSchemaIdentifier schema()
- Specified by:
schema
in interfaceSMFMetadataType
- Returns:
- The metadata schema
-
data
public byte[] data()
- Specified by:
data
in interfaceSMFMetadataType
- Returns:
- The metadata
-
withSchema
public final SMFMetadata withSchema(SMFSchemaIdentifier value)
Copy the current immutable object by setting a value for theschema
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- 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 ofdata
. 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 ofSMFMetadata
that have equal attribute values.- Overrides:
equals
in classjava.lang.Object
- Returns:
true
ifthis
is equal toanother
instance
-
hashCode
public int hashCode()
Computes a hash code from attributes:schema
,data
.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueSMFMetadata
with attribute values.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of the value
-
of
public static SMFMetadata of(SMFSchemaIdentifier schema, byte[] data)
Construct a new immutableSMFMetadata
instance.- Parameters:
schema
- The value for theschema
attributedata
- The value for thedata
attribute- Returns:
- An immutable SMFMetadata instance
-
copyOf
public static SMFMetadata copyOf(SMFMetadataType instance)
Creates an immutable copy of aSMFMetadataType
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 forSMFMetadata
.SMFMetadata.builder() .setSchema(com.io7m.smfj.core.SMFSchemaIdentifier) // required
schema
.setData(byte) // requireddata
.build();- Returns:
- A new SMFMetadata builder
-
-