Record Class Version

java.lang.Object
java.lang.Record
com.intellij.openapi.util.Version
All Implemented Interfaces:
Serializable, Comparable<Version>

public record Version(int major, int minor, int bugfix) extends Record implements Comparable<Version>, Serializable
See Also:
  • Constructor Details

    • Version

      public Version(int major, int minor, int bugfix)
      Creates an instance of a Version record class.
      Parameters:
      major - the value for the major record component
      minor - the value for the minor record component
      bugfix - the value for the bugfix record component
  • Method Details

    • parseVersion

      @Nullable public static @Nullable Version parseVersion(@NotNull @NotNull String versionString)
    • is

      public boolean is(@Nullable @Nullable Integer major)
    • is

      public boolean is(@Nullable @Nullable Integer major, @Nullable @Nullable Integer minor)
    • is

      public boolean is(@Nullable @Nullable Integer major, @Nullable @Nullable Integer minor, @Nullable @Nullable Integer bugfix)
    • isOrGreaterThan

      public boolean isOrGreaterThan(@Nullable @Nullable Integer major)
    • isOrGreaterThan

      public boolean isOrGreaterThan(@Nullable @Nullable Integer major, @Nullable @Nullable Integer minor)
    • isOrGreaterThan

      public boolean isOrGreaterThan(@Nullable @Nullable Integer major, @Nullable @Nullable Integer minor, @Nullable @Nullable Integer bugfix)
    • lessThan

      public boolean lessThan(@Nullable @Nullable Integer major)
    • lessThan

      public boolean lessThan(@Nullable @Nullable Integer major, @Nullable @Nullable Integer minor)
    • lessThan

      public boolean lessThan(@Nullable @Nullable Integer major, @Nullable @Nullable Integer minor, @Nullable @Nullable Integer bugfix)
    • compareTo

      public int compareTo(@NotNull @NotNull Version version)
      Specified by:
      compareTo in interface Comparable<Version>
    • compareTo

      public int compareTo(@Nullable @Nullable Integer major)
    • compareTo

      public int compareTo(@Nullable @Nullable Integer major, @Nullable @Nullable Integer minor)
    • compareTo

      public int compareTo(@Nullable @Nullable Integer major, @Nullable @Nullable Integer minor, @Nullable @Nullable Integer bugfix)
    • 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
    • toCompactString

      @NlsSafe public @NlsSafe String toCompactString()
      Returns:
      compact string representation in the following form: "n.n", "n.n.n", e.g 1.0, 1.1.0
    • toCompactString

      public static String toCompactString(int major, int minor, int bugfix)
    • 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 '=='.
      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
    • bugfix

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