Class VersionString

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

public class VersionString extends Object
A version-string is a list of version-ranges separated by spaces. A version-range is either a version-id, a version-id followed by a star (*), a version-id followed by a plus sign (+) , or two version-ranges combined using an ampersand (&). The star means prefix match, the plus sign means this version or greater, and the ampersand means the logical and-ing of the two version-ranges.

The syntax of version-strings is:

      version-string     ::=  version-range ( " " version-range) *
      version-range      ::=  simple-range ( "&" simple-range) *
      simple-range       ::=  version-id | version-id modifier
      modifier           ::=  "+" | "*"
 

See JSR-56 Specification, Appendix A.

See Also:
  • Field Details

  • Method Details

    • fromString

      public static VersionString fromString(String versionString)
      Construct a version-string by the given versionString.
      Parameters:
      versionString - a version-string
      Returns:
      a versionString
    • containsSingleVersionRange

      public boolean containsSingleVersionRange()
      Returns:
      true if this version-string consists of only a single version-range, false otherwise.
    • isExactVersion

      public boolean isExactVersion()
      Returns:
      true if this version-string consists of a single version-range which is an exact match, false otherwise.
    • getExactVersion

      public VersionId getExactVersion()
      Returns:
      the exact version if this version-string is one
      Throws:
      IllegalStateException - if this version-string is not none
    • contains

      public boolean contains(String versionId)
      Checks if this version-string (list of exact version-ids or version ranges) contains the given versionId.
      Parameters:
      versionId - a version-id
      Returns:
      true if this version-string contains the given versionId, false otherwise
    • contains

      public boolean contains(VersionId versionId)
      Checks if this version-string (list of exact version-ids or version ranges) contains the given versionId.
      Parameters:
      versionId - a version-id
      Returns:
      true if this version-string contains the given versionId, false otherwise
    • equals

      public boolean equals(Object otherVersionString)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Provides string representation of this version-string.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this version-string