Class VersionRange


  • public class VersionRange
    extends java.lang.Object
    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 ( " " element) *
          version-range      ::=  simple-range ( "&" simple-range) *
          simple-range       ::=  version-id | version-id modifier
          modifier           ::=  "+" | "*"
     

    See JSR-56 Specification, Appendix A.

    See Also:
    JNLPVersionPatterns
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private VersionRange​(SimpleRange[] simpleRanges)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(java.lang.String versionId)
      Check if this version-range contains the given versionId.
      boolean contains​(VersionId versionId)
      Check if this version-range contains the given versionId.
      boolean equals​(java.lang.Object otherVersionRange)  
      static VersionRange fromString​(java.lang.String versionRange)
      Construct a version-range by the given versionRange.
      (package private) VersionId getExactVersion()  
      (package private) boolean hasGreaterThanOrEqualMatchModifier()
      Checks whether this version-range represents a range with a greater or equal modifier.
      (package private) boolean hasPrefixMatchModifier()
      Checks whether this version-range represents a range with a prefix match modifier.
      (package private) boolean isCompoundVersion()  
      (package private) boolean isEqualTo​(VersionRange otherVersionRange)  
      (package private) boolean isExactVersion()
      Checks whether this version-range represents a plain (exact) version without any postfix modifiers.
      java.lang.String toString()
      Provides a string representation of this VersionRange.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • simpleRanges

        private final SimpleRange[] simpleRanges
    • Constructor Detail

      • VersionRange

        private VersionRange​(SimpleRange[] simpleRanges)
    • Method Detail

      • isCompoundVersion

        boolean isCompoundVersion()
        Returns:
        true if this version-range is a compound range using an ampersand (&), false otherwise
      • isExactVersion

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

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

        boolean hasPrefixMatchModifier()
        Checks whether this version-range represents a range with a prefix match modifier.
        Returns:
        true if this version-range is not a compound range and its only simple range has a prefix match modifier, false otherwise.
      • hasGreaterThanOrEqualMatchModifier

        boolean hasGreaterThanOrEqualMatchModifier()
        Checks whether this version-range represents a range with a greater or equal modifier.
        Returns:
        true if this version-range is not a compound range and its only simple range has a greater or equal modifier, false otherwise.
      • fromString

        public static VersionRange fromString​(java.lang.String versionRange)
        Construct a version-range by the given versionRange.
        Parameters:
        versionRange - a version-range
        Returns:
        a version-id
      • contains

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

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

        boolean isEqualTo​(VersionRange otherVersionRange)
      • equals

        public boolean equals​(java.lang.Object otherVersionRange)
        Overrides:
        equals in class java.lang.Object
      • toString

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