Class SimpleRange

java.lang.Object
net.adoptopenjdk.icedteaweb.jnlp.version.SimpleRange

class SimpleRange extends Object
A simple-range is either a version-id, a version-id followed by a star (*) or a version-id followed by a plus sign (+). The star means prefix match, the plus sign means this version or greater.

The syntax of version-strings is:

     simple-range       ::=  version-id | version-id modifier
     modifier           ::=  "+" | "*"

See JSR-56 Specification, Appendix A.

See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • isExactVersion

      boolean isExactVersion()
      Checks whether this simple-range represents a single version-id without any postfix modifiers.
      Returns:
      true if this simple-range does not have any modifiers, false otherwise.
    • getExactVersion

      VersionId getExactVersion()
      Returns:
      the exact version if this simple-range is one
      Throws:
      IllegalStateException - if this simple-range is not one
    • hasPrefixMatchModifier

      boolean hasPrefixMatchModifier()
    • hasGreaterThanOrEqualMatchModifier

      boolean hasGreaterThanOrEqualMatchModifier()
    • fromString

      public static SimpleRange fromString(String simpleRange)
      Construct a simple-range by the given simpleRange.
      Parameters:
      simpleRange - a simple-range
      Returns:
      a SimpleRange
    • extractModifier

      private static VersionModifier extractModifier(String simpleRange)
    • extractVersionId

      private static VersionId extractVersionId(String simpleRange)
    • toString

      public String toString()
      Provides a string representation of this SimpleRange.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this simple-range
    • isEqualTo

      boolean isEqualTo(SimpleRange otherSimpleRange)
    • equals

      public boolean equals(Object otherSimpleRange)
      Overrides:
      equals in class Object
    • contains

      public boolean contains(String otherVersionId)
      Check if this simple-range contains the given versionId.
      Parameters:
      otherVersionId - a version-id
      Returns:
      true if this version-range contains versionId, false otherwise.
    • contains

      public boolean contains(VersionId otherVersionId)
      Check if this simple-range contains the given versionId.
      Parameters:
      otherVersionId - a version-id
      Returns:
      true if this version-range contains versionId, false otherwise.