Package com.io7m.smfj.validation.api
Class SMFSchemaVersion
- java.lang.Object
-
- com.io7m.smfj.validation.api.SMFSchemaVersion
-
- All Implemented Interfaces:
SMFSchemaVersionType,java.lang.Comparable<SMFSchemaVersionType>
public final class SMFSchemaVersion extends java.lang.Object implements SMFSchemaVersionType
A schema version. This refers to the version of the schema language, not a specific schema.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSMFSchemaVersion.BuilderBuilds instances of typeSMFSchemaVersion.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SMFSchemaVersion.Builderbuilder()Creates a builder forSMFSchemaVersion.static SMFSchemaVersioncopyOf(SMFSchemaVersionType instance)Creates an immutable copy of aSMFSchemaVersionTypevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofSMFSchemaVersionthat have equal attribute values.inthashCode()Computes a hash code from attributes:major,minor.intmajor()intminor()static SMFSchemaVersionof(int major, int minor)Construct a new immutableSMFSchemaVersioninstance.java.lang.StringtoString()Prints the immutable valueSMFSchemaVersionwith attribute values.SMFSchemaVersionwithMajor(int value)Copy the current immutable object by setting a value for themajorattribute.SMFSchemaVersionwithMinor(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, wait
-
Methods inherited from interface com.io7m.smfj.validation.api.SMFSchemaVersionType
compareTo
-
-
-
-
Method Detail
-
major
public int major()
- Specified by:
majorin interfaceSMFSchemaVersionType- Returns:
- The major number for a format
-
minor
public int minor()
- Specified by:
minorin interfaceSMFSchemaVersionType- Returns:
- The minor number for a format
-
withMajor
public final SMFSchemaVersion withMajor(int value)
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
public final SMFSchemaVersion withMinor(int value)
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 ofSMFSchemaVersionthat 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 valueSMFSchemaVersionwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
of
public static SMFSchemaVersion of(int major, int minor)
Construct a new immutableSMFSchemaVersioninstance.- Parameters:
major- The value for themajorattributeminor- The value for theminorattribute- Returns:
- An immutable SMFSchemaVersion instance
-
copyOf
public static SMFSchemaVersion copyOf(SMFSchemaVersionType instance)
Creates an immutable copy of aSMFSchemaVersionTypevalue. 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 SMFSchemaVersion instance
-
builder
public static SMFSchemaVersion.Builder builder()
Creates a builder forSMFSchemaVersion.SMFSchemaVersion.builder() .setMajor(int) // requiredmajor.setMinor(int) // requiredminor.build();- Returns:
- A new SMFSchemaVersion builder
-
-