Class PolicyVersionPattern


  • public final class PolicyVersionPattern
    extends Object
    Policy Version pattern (as defined by XACML VersionMatchType)
    • Constructor Detail

      • PolicyVersionPattern

        public PolicyVersionPattern​(String xacmlVersionMatch)
                             throws IllegalArgumentException
        Constructs an instance from XACML VersionMatchType-compliant string
        Parameters:
        xacmlVersionMatch - XACML VersionMatchType-compliant string
        Throws:
        IllegalArgumentException - xacmlVersionMatch is not a valid VersionMatch
    • Method Detail

      • toRegex

        public String toRegex()
        Returns:
        the equivalent of this XACML VersionMatchType expression as regular expression (valid for Pattern) without leading '^' or trailing '$'.
      • matches

        public boolean matches​(PolicyVersion version)
        Matches a given policy version
        Parameters:
        version - version to be matched against the pattern
        Returns:
        true iff the version matches
      • isLaterOrMatches

        public boolean isLaterOrMatches​(PolicyVersion version)
        Checks whether the pattern matches the given version or later. This allows to enforce the LatestVersion pattern in XACML Policy(Set)IdReferences.
        Parameters:
        version - version to be matched/compared
        Returns:
        true iff this pattern matches version or later.
      • isEarlierOrMatches

        public boolean isEarlierOrMatches​(PolicyVersion version)
        Checks whether the pattern matches the given version or earlier. This allows to enforce the EarliestVersion pattern in XACML Policy(Set)IdReferences.
        Parameters:
        version - version to be matched/compared
        Returns:
        true iff this pattern matches version or earlier.
      • toLiteral

        public PolicyVersion toLiteral()
        Return the pattern as literal version if the internal XACML VersionMatch is actually a literal version string (no wildcard character like '*' or '+')
        Returns:
        literal/constant policy version, or null if the pattern is not a literal value (based on VersionMatch expression that contains '*' or '+')