Class SimpleRange


  • class SimpleRange
    extends java.lang.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:
    JNLPVersionPatterns
    • Method Detail

      • 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:
        java.lang.IllegalStateException - if this simple-range is not one
      • hasPrefixMatchModifier

        boolean hasPrefixMatchModifier()
      • hasGreaterThanOrEqualMatchModifier

        boolean hasGreaterThanOrEqualMatchModifier()
      • fromString

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

        private static VersionModifier extractModifier​(java.lang.String simpleRange)
      • extractVersionId

        private static VersionId extractVersionId​(java.lang.String simpleRange)
      • toString

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

        boolean isEqualTo​(SimpleRange otherSimpleRange)
      • equals

        public boolean equals​(java.lang.Object otherSimpleRange)
        Overrides:
        equals in class java.lang.Object
      • contains

        public boolean contains​(java.lang.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.