- java.lang.Object
-
- com.io7m.changelog.core.CVersionStandard
-
- All Implemented Interfaces:
CVersionStandardType,CVersionType,Comparable<CVersionType>
public final class CVersionStandard extends Object implements CVersionStandardType
The type of standard version numbers of the form
M.N.P-S, whereMis the major version,Nis the minor version,Pis the patch number, andSis an arbitrary qualifier string.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCVersionStandard.BuilderBuilds instances of typeCVersionStandard.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CVersionStandard.Builderbuilder()Creates a builder forCVersionStandard.static CVersionStandardcopyOf(CVersionStandardType instance)Creates an immutable copy of aCVersionStandardTypevalue.booleanequals(Object another)This instance is equal to all instances ofCVersionStandardthat have equal attribute values.inthashCode()Computes a hash code from attributes:major,minor,patch,qualifier.intmajor()intminor()static CVersionStandardof(int major, int minor, int patch, String qualifier)Construct a new immutableCVersionStandardinstance.intpatch()Stringqualifier()StringtoString()Prints the immutable valueCVersionStandardwith attribute values.CVersionStandardwithMajor(int value)Copy the current immutable object by setting a value for themajorattribute.CVersionStandardwithMinor(int value)Copy the current immutable object by setting a value for theminorattribute.CVersionStandardwithPatch(int value)Copy the current immutable object by setting a value for thepatchattribute.CVersionStandardwithQualifier(String value)Copy the current immutable object by setting a value for thequalifierattribute.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.io7m.changelog.core.CVersionStandardType
checkPreconditions, compareTo, toVersionString, versionAccept
-
-
-
-
Method Detail
-
major
public int major()
- Specified by:
majorin interfaceCVersionStandardType- Returns:
- The major version number
-
minor
public int minor()
- Specified by:
minorin interfaceCVersionStandardType- Returns:
- The minor version number
-
patch
public int patch()
- Specified by:
patchin interfaceCVersionStandardType- Returns:
- The patch number
-
qualifier
public String qualifier()
- Specified by:
qualifierin interfaceCVersionStandardType- Returns:
- The qualifier component of the version number
-
withMajor
public final CVersionStandard 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 CVersionStandard 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
-
withPatch
public final CVersionStandard withPatch(int value)
Copy the current immutable object by setting a value for thepatchattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for patch- Returns:
- A modified copy of the
thisobject
-
withQualifier
public final CVersionStandard withQualifier(String value)
Copy the current immutable object by setting a value for thequalifierattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for qualifier- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(Object another)
This instance is equal to all instances ofCVersionStandardthat have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:major,minor,patch,qualifier.
-
toString
public String toString()
Prints the immutable valueCVersionStandardwith attribute values.
-
of
public static CVersionStandard of(int major, int minor, int patch, String qualifier)
Construct a new immutableCVersionStandardinstance.- Parameters:
major- The value for themajorattributeminor- The value for theminorattributepatch- The value for thepatchattributequalifier- The value for thequalifierattribute- Returns:
- An immutable CVersionStandard instance
-
copyOf
public static CVersionStandard copyOf(CVersionStandardType instance)
Creates an immutable copy of aCVersionStandardTypevalue. 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 CVersionStandard instance
-
builder
public static CVersionStandard.Builder builder()
Creates a builder forCVersionStandard.- Returns:
- A new CVersionStandard builder
-
-