Class PolicyVersionPattern
- java.lang.Object
-
- org.ow2.authzforce.core.pdp.api.policy.PolicyVersionPattern
-
public final class PolicyVersionPattern extends Object
Policy Version pattern (as defined by XACML VersionMatchType)
-
-
Constructor Summary
Constructors Constructor Description PolicyVersionPattern(String xacmlVersionMatch)
Constructs an instance from XACML VersionMatchType-compliant string
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isEarlierOrMatches(PolicyVersion version)
Checks whether the pattern matches the given version or earlier.boolean
isLaterOrMatches(PolicyVersion version)
Checks whether the pattern matches the given version or later.boolean
matches(PolicyVersion version)
Matches a given policy versionPolicyVersion
toLiteral()
Return the pattern as literal version if the internal XACML VersionMatch is actually a literal version string (no wildcard character like '*' or '+')String
toRegex()
String
toString()
-
-
-
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 '+')
-
-