Record Class Version.AppendingVersion

java.lang.Object
java.lang.Record
net.luis.utils.util.Version.AppendingVersion
Record Components:
separator - The separator character
version - The version number
All Implemented Interfaces:
Comparable<Version.AppendingVersion>
Enclosing class:
Version

protected static record Version.AppendingVersion(char separator, int version) extends Record implements Comparable<Version.AppendingVersion>
This record represents an appendable version number.
The record is used for the build and suffix version numbers.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final Version.AppendingVersion
    An empty appendable version number.
    The separator is '\0' and the version is -1.
    This is the default value for an empty version number.
    private final char
    The field for the separator record component.
    private final int
    The field for the version record component.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AppendingVersion(char separator, int version)
    Creates an instance of a AppendingVersion record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compares this appendable version number with the given appendable version number.
    The comparison is based on the version number, the separator is not considered.
    boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns a hash code value for this object.
    boolean
    Checks if the version number is not empty.
    The version number is not empty if the separator is not '\0' and the version is not -1.
    char
    Returns the value of the separator record component.
    Returns a string representation of this record class.
    int
    Returns the value of the version record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • separator

      private final char separator
      The field for the separator record component.
    • version

      private final int version
      The field for the version record component.
    • EMPTY

      private static final Version.AppendingVersion EMPTY
      An empty appendable version number.
      The separator is '\0' and the version is -1.
      This is the default value for an empty version number.
  • Constructor Details

    • AppendingVersion

      protected AppendingVersion(char separator, int version)
      Creates an instance of a AppendingVersion record class.
      Parameters:
      separator - the value for the separator record component
      version - the value for the version record component
  • Method Details

    • isNotEmpty

      public boolean isNotEmpty()
      Checks if the version number is not empty.
      The version number is not empty if the separator is not '\0' and the version is not -1.
      Returns:
      True if the version number is not empty, otherwise false
    • compareTo

      public int compareTo(@NotNull @NotNull Version.AppendingVersion o)
      Compares this appendable version number with the given appendable version number.
      The comparison is based on the version number, the separator is not considered.
      Specified by:
      compareTo in interface Comparable<Version.AppendingVersion>
      Parameters:
      o - The appendable version to compare with
      Returns:
      The comparison result
    • equals

      public 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. All components in this record class are compared with '=='.
      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.
    • hashCode

      public 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
    • 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
    • separator

      public char separator()
      Returns the value of the separator record component.
      Returns:
      the value of the separator record component
    • version

      public int version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component