Class PolicyVersionPatterns


  • public final class PolicyVersionPatterns
    extends Object
    Version patterns used in policy references to match specific policy version(s). This class also provides a simple set of comparison methods for matching against the patterns.
    • Field Detail

      • WILDCARD

        public static final PolicyVersionPattern WILDCARD
        Wildcard pattern, i.e. version pattern that matches any version ('*')
    • Constructor Detail

      • PolicyVersionPatterns

        public PolicyVersionPatterns​(String versionMatch,
                                     String earliestMatch,
                                     String latestMatch)
                              throws IllegalArgumentException
        Creates a VersionConstraints with the three optional constraint strings. Each of the three strings must conform to the VersionMatchType type defined in the XACML schema. Any of the strings may be null to specify that the given constraint is not used.
        Parameters:
        versionMatch - matching expression for the version; or null if none
        earliestMatch - matching expression for the earliest acceptable version; or null if none
        latestMatch - matching expression for the earliest acceptable version; or null if none
        Throws:
        IllegalArgumentException - if one of the match expressions is invalid
    • Method Detail

      • matchLatestVersion

        public boolean matchLatestVersion​(PolicyVersion version)
        Check version against LatestVersion pattern
        Parameters:
        version - input version to be checked
        Returns:
        true iff LatestVersion matched
      • matchEarliestVersion

        public boolean matchEarliestVersion​(PolicyVersion version)
        Check version against EarliestVersion pattern
        Parameters:
        version - input version to be checked
        Returns:
        true iff EarliestVersion matched
      • matchVersion

        public boolean matchVersion​(PolicyVersion version)
        Check version against Version pattern
        Parameters:
        version - input version to be checked
        Returns:
        true iff Version matched
      • getVersionPattern

        public Optional<PolicyVersionPattern> getVersionPattern()
        Get Version pattern:
        Returns:
        Version to be matched; null if none
      • getEarliestVersionPattern

        public Optional<PolicyVersionPattern> getEarliestVersionPattern()
        Get EarliestVersion pattern: matching expression for the earliest acceptable version
        Returns:
        EarliestVersion pattern to be matched; null if none
      • getLatestVersionPattern

        public Optional<PolicyVersionPattern> getLatestVersionPattern()
        Get LatestVersion pattern: matching expression for the latest acceptable version
        Returns:
        LatestVersion pattern to be matched; null if none