Class PolicyVersionPatterns
- java.lang.Object
-
- org.ow2.authzforce.core.pdp.api.policy.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 Summary
Fields Modifier and Type Field Description static PolicyVersionPattern
WILDCARD
Wildcard pattern, i.e.
-
Constructor Summary
Constructors Constructor Description PolicyVersionPatterns(String versionMatch, String earliestMatch, String latestMatch)
Creates aVersionConstraints
with the three optional constraint strings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<PolicyVersionPattern>
getEarliestVersionPattern()
Get EarliestVersion pattern: matching expression for the earliest acceptable versionOptional<PolicyVersionPattern>
getLatestVersionPattern()
Get LatestVersion pattern: matching expression for the latest acceptable versionOptional<PolicyVersionPattern>
getVersionPattern()
Get Version pattern:boolean
matchEarliestVersion(PolicyVersion version)
Check version against EarliestVersion patternboolean
matchLatestVersion(PolicyVersion version)
Check version against LatestVersion patternboolean
matchVersion(PolicyVersion version)
Check version against Version patternString
toString()
-
-
-
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 aVersionConstraints
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 noneearliestMatch
- matching expression for the earliest acceptable version; or null if nonelatestMatch
- 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
-
-