Record Class SemVer

java.lang.Object
java.lang.Record
org.ehrbase.util.SemVer

public record SemVer(Integer major, Integer minor, Integer patch, String suffix) extends Record
  • Field Details

    • SEMVER_REGEX

      public static final Pattern SEMVER_REGEX
      partial, release and pre-release versions are permitted
    • NO_VERSION

      public static final SemVer NO_VERSION
  • Constructor Details

    • SemVer

      public SemVer(Integer major, Integer minor, Integer patch, String suffix)
      Creates an instance of a SemVer record class.
      Parameters:
      major - the value for the major record component
      minor - the value for the minor record component
      patch - the value for the patch record component
      suffix - the value for the suffix record component
  • Method Details

    • parse

      @NonNull public static SemVer parse(String semVerStr) throws InvalidVersionFormatException
      Throws:
      InvalidVersionFormatException
    • toVersionString

      public String toVersionString()
    • isNoVersion

      public boolean isNoVersion()
    • isPartial

      public boolean isPartial()
    • isRelease

      public boolean isRelease()
    • isPreRelease

      public boolean isPreRelease()
    • 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
    • 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.
    • major

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

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

      public Integer patch()
      Returns the value of the patch record component.
      Returns:
      the value of the patch record component
    • suffix

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