Package com.io7m.smfj.core
Class SMFFormatDescription
- java.lang.Object
-
- com.io7m.smfj.core.SMFFormatDescription
-
- All Implemented Interfaces:
SMFFormatDescriptionType
public final class SMFFormatDescription extends java.lang.Object implements SMFFormatDescriptionType
A description of a format.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSMFFormatDescription.BuilderBuilds instances of typeSMFFormatDescription.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SMFFormatDescription.Builderbuilder()Creates a builder forSMFFormatDescription.static SMFFormatDescriptioncopyOf(SMFFormatDescriptionType instance)Creates an immutable copy of aSMFFormatDescriptionTypevalue.java.lang.Stringdescription()booleanequals(java.lang.Object another)This instance is equal to all instances ofSMFFormatDescriptionthat have equal attribute values.inthashCode()Computes a hash code from attributes:description,suffix,mimeType,name,randomAccess.java.lang.StringmimeType()java.lang.Stringname()booleanrandomAccess()java.lang.Stringsuffix()java.lang.StringtoString()Prints the immutable valueSMFFormatDescriptionwith attribute values.SMFFormatDescriptionwithDescription(java.lang.String value)Copy the current immutable object by setting a value for thedescriptionattribute.SMFFormatDescriptionwithMimeType(java.lang.String value)Copy the current immutable object by setting a value for themimeTypeattribute.SMFFormatDescriptionwithName(java.lang.String value)Copy the current immutable object by setting a value for thenameattribute.SMFFormatDescriptionwithRandomAccess(boolean value)Copy the current immutable object by setting a value for therandomAccessattribute.SMFFormatDescriptionwithSuffix(java.lang.String value)Copy the current immutable object by setting a value for thesuffixattribute.
-
-
-
Method Detail
-
description
public java.lang.String description()
- Specified by:
descriptionin interfaceSMFFormatDescriptionType- Returns:
- A human-readable description of the format
-
suffix
public java.lang.String suffix()
- Specified by:
suffixin interfaceSMFFormatDescriptionType- Returns:
- The filename suffix used for the format
-
mimeType
public java.lang.String mimeType()
- Specified by:
mimeTypein interfaceSMFFormatDescriptionType- Returns:
- The mime type for the format
-
name
public java.lang.String name()
- Specified by:
namein interfaceSMFFormatDescriptionType- Returns:
- The unique name for the format
-
randomAccess
public boolean randomAccess()
- Specified by:
randomAccessin interfaceSMFFormatDescriptionType- Returns:
trueiff the format supports random access
-
withDescription
public final SMFFormatDescription withDescription(java.lang.String value)
Copy the current immutable object by setting a value for thedescriptionattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for description- Returns:
- A modified copy of the
thisobject
-
withSuffix
public final SMFFormatDescription withSuffix(java.lang.String value)
Copy the current immutable object by setting a value for thesuffixattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for suffix- Returns:
- A modified copy of the
thisobject
-
withMimeType
public final SMFFormatDescription withMimeType(java.lang.String value)
Copy the current immutable object by setting a value for themimeTypeattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for mimeType- Returns:
- A modified copy of the
thisobject
-
withName
public final SMFFormatDescription withName(java.lang.String value)
Copy the current immutable object by setting a value for thenameattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for name- Returns:
- A modified copy of the
thisobject
-
withRandomAccess
public final SMFFormatDescription withRandomAccess(boolean value)
Copy the current immutable object by setting a value for therandomAccessattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for randomAccess- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofSMFFormatDescriptionthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()
Computes a hash code from attributes:description,suffix,mimeType,name,randomAccess.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueSMFFormatDescriptionwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
public static SMFFormatDescription copyOf(SMFFormatDescriptionType instance)
Creates an immutable copy of aSMFFormatDescriptionTypevalue. 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 SMFFormatDescription instance
-
builder
public static SMFFormatDescription.Builder builder()
Creates a builder forSMFFormatDescription.SMFFormatDescription.builder() .setDescription(String) // requireddescription.setSuffix(String) // requiredsuffix.setMimeType(String) // requiredmimeType.setName(String) // requiredname.setRandomAccess(boolean) // requiredrandomAccess.build();- Returns:
- A new SMFFormatDescription builder
-
-