Record Class ARI1Version

java.lang.Object
java.lang.Record
com.io7m.aradine.instrument.spi1.ARI1Version
Record Components:
major - The major number
minor - The minor number
patch - The patch number
qualifier - The (possibly empty) qualifier
All Implemented Interfaces:
Comparable<ARI1Version>

public record ARI1Version(int major, int minor, int patch, Optional<ARI1VersionQualifier> qualifier) extends Record implements Comparable<ARI1Version>
A (semantic) version number.
  • Constructor Details

    • ARI1Version

      public ARI1Version(int major, int minor, int patch, Optional<ARI1VersionQualifier> qualifier)
      A (semantic) version number.
      Parameters:
      major - The major number
      minor - The minor number
      patch - The patch number
      qualifier - The (possibly empty) qualifier
  • Method Details

    • isSnapshot

      public boolean isSnapshot()
      Returns:
      true if this version is a snapshot version
    • of

      public static ARI1Version of(int major, int minor, int patch)
      Create a version number without a qualifier.
      Parameters:
      major - The major version
      minor - The minor version
      patch - The patch version
      Returns:
      A version number
    • of

      public static ARI1Version of(int major, int minor, int patch, ARI1VersionQualifier qualifier)
      Create a version number with a qualifier.
      Parameters:
      major - The major version
      minor - The minor version
      patch - The patch version
      qualifier - The qualifier
      Returns:
      A version number
    • of

      public static ARI1Version of(int major, int minor, int patch, String qualifier) throws IllegalArgumentException
      Create a version number with a qualifier.
      Parameters:
      major - The major version
      minor - The minor version
      patch - The patch version
      qualifier - The qualifier
      Returns:
      A version number
      Throws:
      IllegalArgumentException - On unparseable qualifiers
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • compareTo

      public int compareTo(ARI1Version other)
      Specified by:
      compareTo in interface Comparable<ARI1Version>
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • major

      public int major()
      Returns the value of the major record component.
      Returns:
      the value of the major record component
    • minor

      public int minor()
      Returns the value of the minor record component.
      Returns:
      the value of the minor record component
    • patch

      public int patch()
      Returns the value of the patch record component.
      Returns:
      the value of the patch record component
    • qualifier

      public Optional<ARI1VersionQualifier> qualifier()
      Returns the value of the qualifier record component.
      Returns:
      the value of the qualifier record component