Class CVersion

java.lang.Object
com.io7m.changelog.core.CVersion
All Implemented Interfaces:
CVersionType, Comparable<CVersionType>, Formattable

public final class CVersion extends Object implements CVersionType
A version number.
  • Method Details

    • major

      public BigInteger major()
      Specified by:
      major in interface CVersionType
      Returns:
      The major version
    • minor

      public BigInteger minor()
      Specified by:
      minor in interface CVersionType
      Returns:
      The minor version
    • patch

      public BigInteger patch()
      Specified by:
      patch in interface CVersionType
      Returns:
      The patch version
    • qualifier

      public Optional<CVersionQualifier> qualifier()
      Specified by:
      qualifier in interface CVersionType
      Returns:
      The version qualifier
    • withMajor

      public final CVersion withMajor(BigInteger value)
      Copy the current immutable object by setting a value for the major attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for major
      Returns:
      A modified copy of the this object
    • withMinor

      public final CVersion withMinor(BigInteger value)
      Copy the current immutable object by setting a value for the minor attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for minor
      Returns:
      A modified copy of the this object
    • withPatch

      public final CVersion withPatch(BigInteger value)
      Copy the current immutable object by setting a value for the patch attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for patch
      Returns:
      A modified copy of the this object
    • withQualifier

      public final CVersion withQualifier(CVersionQualifier value)
      Copy the current immutable object by setting a present value for the optional qualifier attribute.
      Parameters:
      value - The value for qualifier
      Returns:
      A modified copy of this object
    • withQualifier

      public final CVersion withQualifier(Optional<? extends CVersionQualifier> optional)
      Copy the current immutable object by setting an optional value for the qualifier attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for qualifier
      Returns:
      A modified copy of this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of CVersion that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: major, minor, patch, qualifier.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value CVersion with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • of

      public static CVersion of(BigInteger major, BigInteger minor, BigInteger patch)
      Construct a new immutable CVersion instance.
      Parameters:
      major - The value for the major attribute
      minor - The value for the minor attribute
      patch - The value for the patch attribute
      Returns:
      An immutable CVersion instance
    • copyOf

      public static CVersion copyOf(CVersionType instance)
      Creates an immutable copy of a CVersionType value. 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

      public static CVersion.Builder builder()
      Creates a builder for CVersion.
       CVersion.builder()
          .setMajor(java.math.BigInteger) // required major
          .setMinor(java.math.BigInteger) // required minor
          .setPatch(java.math.BigInteger) // required patch
          .setQualifier(com.io7m.changelog.core.CVersionQualifier) // optional qualifier
          .build();
       
      Returns:
      A new CVersion builder