Class FormatDescription
java.lang.Object
com.io7m.coffeepick.runtime.parser.spi.FormatDescription
- All Implemented Interfaces:
FormatDescriptionType
public final class FormatDescription extends java.lang.Object implements FormatDescriptionType
A runtimes of a supported format.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFormatDescription.BuilderBuilds instances of typeFormatDescription. -
Method Summary
Modifier and Type Method Description static FormatDescription.Builderbuilder()Creates a builder forFormatDescription.static FormatDescriptioncopyOf(FormatDescriptionType instance)Creates an immutable copy of aFormatDescriptionTypevalue.java.lang.Stringdescription()booleanequals(java.lang.Object another)This instance is equal to all instances ofFormatDescriptionthat have equal attribute values.inthashCode()Computes a hash code from attributes:description,mimeType,name.java.lang.StringmimeType()java.net.URIname()java.lang.StringtoString()Prints the immutable valueFormatDescriptionwith attribute values.FormatDescriptionwithDescription(java.lang.String value)Copy the current immutable object by setting a value for thedescriptionattribute.FormatDescriptionwithMimeType(java.lang.String value)Copy the current immutable object by setting a value for themimeTypeattribute.FormatDescriptionwithName(java.net.URI value)Copy the current immutable object by setting a value for thenameattribute.
-
Method Details
-
description
public java.lang.String description()- Specified by:
descriptionin interfaceFormatDescriptionType- Returns:
- A human-readable runtimes of the format
-
mimeType
public java.lang.String mimeType()- Specified by:
mimeTypein interfaceFormatDescriptionType- Returns:
- The mime type for the format
-
name
public java.net.URI name()- Specified by:
namein interfaceFormatDescriptionType- Returns:
- The unique name for the format
-
withDescription
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
-
withMimeType
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
Copy the current immutable object by setting a value for thenameattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for name- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(java.lang.Object another)This instance is equal to all instances ofFormatDescriptionthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()Computes a hash code from attributes:description,mimeType,name.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()Prints the immutable valueFormatDescriptionwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
Creates an immutable copy of aFormatDescriptionTypevalue. 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 FormatDescription instance
-
builder
Creates a builder forFormatDescription.FormatDescription.builder() .setDescription(String) // requireddescription.setMimeType(String) // requiredmimeType.setName(java.net.URI) // requiredname.build();- Returns:
- A new FormatDescription builder
-