Record Class Version

java.lang.Object
java.lang.Record
de.eldoria.eldoutilities.utils.Version
All Implemented Interfaces:
Comparable<Version>

public record Version(String version, List<Integer> nums) extends Record implements Comparable<Version>
  • Field Details

  • Constructor Details

    • Version

      public Version(String version, List<Integer> nums)
      Creates an instance of a Version record class.
      Parameters:
      version - the value for the version record component
      nums - the value for the nums record component
  • Method Details

    • parse

      public static Version parse(String version)
    • of

      public static Version of(Integer... nums)
    • of

      public static Version of(List<Integer> nums)
    • nums

      public List<Integer> nums()
      Returns the value of the nums record component.
      Returns:
      the value of the nums record component
    • isOlder

      public boolean isOlder(Version version)
    • isOlderOrEqual

      public boolean isOlderOrEqual(Version version)
    • isNewer

      public boolean isNewer(Version version)
    • isNewerOrEqual

      public boolean isNewerOrEqual(Version version)
    • isEqual

      public boolean isEqual(Version version)
    • isBetweenInclusive

      public boolean isBetweenInclusive(Version lower, Version upper)
    • isBetween

      public boolean isBetween(Version lower, Version upper)
      Compares the version to a lower and upper version
      Parameters:
      lower - lower version (inclusive)
      upper - upper version (exclusive)
      Returns:
      true if the version is between
    • comparator

      public Comparator<String> comparator()
    • trim

      public Version trim(int num)
    • set

      public Version set(int index, int value)
    • increase

      public Version increase(int index, int value)
    • decrease

      public Version decrease(int index, int value)
    • 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
    • size

      public int size()
    • compareTo

      public int compareTo(@NotNull @NotNull Version version)
      Specified by:
      compareTo in interface Comparable<Version>
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • version

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