Record Class Vers

java.lang.Object
java.lang.Record
io.github.nscuro.versatile.Vers
Record Components:
scheme - The versioning scheme of this version range
constraints - The Constraints composing this version range

public record Vers(String scheme, List<Constraint> constraints) extends Record
A version range as defined in the vers specification.
See Also:
  • Constructor Details

    • Vers

      public Vers(String scheme, List<Constraint> constraints)
      Creates an instance of a Vers record class.
      Parameters:
      scheme - the value for the scheme record component
      constraints - the value for the constraints record component
  • Method Details

    • parse

      public static Vers parse(String versString)
    • split

      public List<Vers> split()
    • builder

      public static Vers.Builder builder(String versioningScheme)
    • scheme

      public String scheme()
      Returns the value of the scheme record component.
      Returns:
      the value of the scheme record component
    • constraints

      public List<Constraint> constraints()
      Returns the value of the constraints record component.
      Returns:
      the value of the constraints record component
    • isWildcard

      public boolean isWildcard()
    • contains

      public boolean contains(String versionStr)
    • simplify

      public Vers simplify()
    • validate

      public Vers validate()
    • overlapsWith

      public boolean overlapsWith(Vers vers)
      Checks if his vers has a potential version overlap with another vers
      Parameters:
      vers - the vers to check for overlap with
      Returns:
      true if there is an overlap, false otherwise
      Throws:
      VersException - if the compared verses have different schemes
    • invert

      public Vers invert()
      Inverts a given vers expression and returns a new simplified vers
      Throws:
      VersException - if the vers is a wildcard
    • 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
    • removeUnboundedConstraints

      public static List<Constraint> removeUnboundedConstraints(Vers vers)
    • 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.