Class FormatVersion
java.lang.Object
com.io7m.coffeepick.runtime.parser.spi.FormatVersion
- All Implemented Interfaces:
FormatVersionType,java.lang.Comparable<FormatVersionType>
public final class FormatVersion extends java.lang.Object implements FormatVersionType
A format version.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFormatVersion.BuilderBuilds instances of typeFormatVersion. -
Method Summary
Modifier and Type Method Description static FormatVersion.Builderbuilder()Creates a builder forFormatVersion.static FormatVersioncopyOf(FormatVersionType instance)Creates an immutable copy of aFormatVersionTypevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofFormatVersionthat have equal attribute values.inthashCode()Computes a hash code from attributes:major,minor.intmajor()intminor()static FormatVersionof(int major, int minor)Construct a new immutableFormatVersioninstance.java.lang.StringtoString()Prints the immutable valueFormatVersionwith attribute values.FormatVersionwithMajor(int value)Copy the current immutable object by setting a value for themajorattribute.FormatVersionwithMinor(int value)Copy the current immutable object by setting a value for theminorattribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.io7m.coffeepick.runtime.parser.spi.FormatVersionType
compareTo, toHumanString
-
Method Details
-
major
public int major()- Specified by:
majorin interfaceFormatVersionType- Returns:
- The major number for a format
-
minor
public int minor()- Specified by:
minorin interfaceFormatVersionType- Returns:
- The minor number for a format
-
withMajor
Copy the current immutable object by setting a value for themajorattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for major- Returns:
- A modified copy of the
thisobject
-
withMinor
Copy the current immutable object by setting a value for theminorattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for minor- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(java.lang.Object another)This instance is equal to all instances ofFormatVersionthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()Computes a hash code from attributes:major,minor.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()Prints the immutable valueFormatVersionwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
of
Construct a new immutableFormatVersioninstance.- Parameters:
major- The value for themajorattributeminor- The value for theminorattribute- Returns:
- An immutable FormatVersion instance
-
copyOf
Creates an immutable copy of aFormatVersionTypevalue. 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 FormatVersion instance
-
builder
Creates a builder forFormatVersion.FormatVersion.builder() .setMajor(int) // requiredmajor.setMinor(int) // requiredminor.build();- Returns:
- A new FormatVersion builder
-