Package com.io7m.changelog.core
Class CVersion
java.lang.Object
com.io7m.changelog.core.CVersion
- All Implemented Interfaces:
CVersionType,Comparable<CVersionType>,Formattable
A version number.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic CVersion.Builderbuilder()Creates a builder forCVersion.static CVersioncopyOf(CVersionType instance) Creates an immutable copy of aCVersionTypevalue.booleanThis instance is equal to all instances ofCVersionthat have equal attribute values.inthashCode()Computes a hash code from attributes:major,minor,patch,qualifier.major()minor()static CVersionof(BigInteger major, BigInteger minor, BigInteger patch) Construct a new immutableCVersioninstance.patch()toString()Prints the immutable valueCVersionwith attribute values.final CVersionwithMajor(BigInteger value) Copy the current immutable object by setting a value for themajorattribute.final CVersionwithMinor(BigInteger value) Copy the current immutable object by setting a value for theminorattribute.final CVersionwithPatch(BigInteger value) Copy the current immutable object by setting a value for thepatchattribute.final CVersionwithQualifier(CVersionQualifier value) Copy the current immutable object by setting a present value for the optionalqualifierattribute.final CVersionwithQualifier(Optional<? extends CVersionQualifier> optional) Copy the current immutable object by setting an optional value for thequalifierattribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.io7m.changelog.core.CVersionType
checkPreconditions, compareTo, formatTo
-
Method Details
-
major
- Specified by:
majorin interfaceCVersionType- Returns:
- The major version
-
minor
- Specified by:
minorin interfaceCVersionType- Returns:
- The minor version
-
patch
- Specified by:
patchin interfaceCVersionType- Returns:
- The patch version
-
qualifier
- Specified by:
qualifierin interfaceCVersionType- Returns:
- The version qualifier
-
withMajor
Copy the current immutable object by setting a value for themajorattribute. An equals check 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. An equals check 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
Copy the current immutable object by setting a value for thepatchattribute. An equals check 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
Copy the current immutable object by setting a present value for the optionalqualifierattribute.- Parameters:
value- The value for qualifier- Returns:
- A modified copy of
thisobject
-
withQualifier
Copy the current immutable object by setting an optional value for thequalifierattribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for qualifier- Returns:
- A modified copy of
thisobject
-
equals
This instance is equal to all instances ofCVersionthat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:major,minor,patch,qualifier. -
toString
Prints the immutable valueCVersionwith attribute values. -
of
Construct a new immutableCVersioninstance.- Parameters:
major- The value for themajorattributeminor- The value for theminorattributepatch- The value for thepatchattribute- Returns:
- An immutable CVersion instance
-
copyOf
Creates an immutable copy of aCVersionTypevalue. 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 CVersion instance
-
builder
Creates a builder forCVersion.CVersion.builder() .setMajor(java.math.BigInteger) // requiredmajor.setMinor(java.math.BigInteger) // requiredminor.setPatch(java.math.BigInteger) // requiredpatch.setQualifier(com.io7m.changelog.core.CVersionQualifier) // optionalqualifier.build();- Returns:
- A new CVersion builder
-