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 classSMFMetadata.BuilderBuilds instances of typeSMFMetadata.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SMFMetadata.Builderbuilder()Creates a builder forSMFMetadata.static SMFMetadatacopyOf(SMFMetadataType instance)Creates an immutable copy of aSMFMetadataTypevalue.byte[]data()booleanequals(java.lang.Object another)This instance is equal to all instances ofSMFMetadatathat have equal attribute values.inthashCode()Computes a hash code from attributes:schema,data.static SMFMetadataof(SMFSchemaIdentifier schema, byte[] data)Construct a new immutableSMFMetadatainstance.SMFSchemaIdentifierschema()java.lang.StringtoString()Prints the immutable valueSMFMetadatawith attribute values.SMFMetadatawithData(byte... elements)Copy the current immutable object with elements that replace the content ofdata.SMFMetadatawithSchema(SMFSchemaIdentifier value)Copy the current immutable object by setting a value for theschemaattribute.
-
-
-
Method Detail
-
schema
public SMFSchemaIdentifier schema()
- Specified by:
schemain interfaceSMFMetadataType- Returns:
- The metadata schema
-
data
public byte[] data()
- Specified by:
datain interfaceSMFMetadataType- Returns:
- The metadata
-
withSchema
public final SMFMetadata withSchema(SMFSchemaIdentifier value)
Copy the current immutable object by setting a value for theschemaattribute. 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
thisobject
-
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
thisobject
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofSMFMetadatathat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()
Computes a hash code from attributes:schema,data.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueSMFMetadatawith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
of
public static SMFMetadata of(SMFSchemaIdentifier schema, byte[] data)
Construct a new immutableSMFMetadatainstance.- Parameters:
schema- The value for theschemaattributedata- The value for thedataattribute- Returns:
- An immutable SMFMetadata instance
-
copyOf
public static SMFMetadata copyOf(SMFMetadataType instance)
Creates an immutable copy of aSMFMetadataTypevalue. 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) // requiredschema.setData(byte) // requireddata.build();- Returns:
- A new SMFMetadata builder
-
-