Package org.forgerock.json.resource
Class Filters
- java.lang.Object
-
- org.forgerock.json.resource.Filters
-
public final class Filters extends Object
This class contains methods for creating various kinds ofFilter
andFilterCondition
s.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FilterCondition
and(Collection<FilterCondition> conditions)
Returns aFilterCondition
which will only match requests which match all the provided conditions.static FilterCondition
and(FilterCondition... conditions)
Returns aFilterCondition
which will only match requests which match all the provided conditions.static Filter
conditionalFilter(FilterCondition condition, Filter subFilter)
Returns aFilter
which will only invokesubFilter
when the provided filter condition matches the request being processed.static FilterCondition
matchRequestType(Set<RequestType> types)
Returns aFilterCondition
which will only match requests whose type is contained intypes
.static FilterCondition
matchRequestType(RequestType... types)
Returns aFilterCondition
which will only match requests whose type is contained intypes
.static FilterCondition
matchResourcePath(String regex)
Returns aFilterCondition
which will only match requests whose resource path matches the provided regular expression.static FilterCondition
matchResourcePath(Pattern regex)
Returns aFilterCondition
which will only match requests whose resource path matches the provided regular expression.static FilterCondition
not(FilterCondition condition)
Returns aFilterCondition
which will match requests which do not match the provided condition.static FilterCondition
or(Collection<FilterCondition> conditions)
Returns aFilterCondition
which will match requests which match any of the provided conditions.static FilterCondition
or(FilterCondition... conditions)
Returns aFilterCondition
which will match requests which match any of the provided conditions.
-
-
-
Method Detail
-
and
public static FilterCondition and(Collection<FilterCondition> conditions)
Returns aFilterCondition
which will only match requests which match all the provided conditions.- Parameters:
conditions
- The conditions which requests must match.- Returns:
- The filter condition.
-
and
public static FilterCondition and(FilterCondition... conditions)
Returns aFilterCondition
which will only match requests which match all the provided conditions.- Parameters:
conditions
- The conditions which requests must match.- Returns:
- The filter condition.
-
conditionalFilter
public static Filter conditionalFilter(FilterCondition condition, Filter subFilter)
Returns aFilter
which will only invokesubFilter
when the provided filter condition matches the request being processed.- Parameters:
condition
- The filter condition.subFilter
- The sub-filter to be invoked when the condition matches.- Returns:
- The wrapped filter.
-
matchRequestType
public static FilterCondition matchRequestType(RequestType... types)
Returns aFilterCondition
which will only match requests whose type is contained intypes
.- Parameters:
types
- The request types which should be handled by the filter.- Returns:
- The filter condition.
- See Also:
Request.getRequestType()
-
matchRequestType
public static FilterCondition matchRequestType(Set<RequestType> types)
Returns aFilterCondition
which will only match requests whose type is contained intypes
.- Parameters:
types
- The request types which should be handled by the filter.- Returns:
- The filter condition.
- See Also:
Request.getRequestType()
-
matchResourcePath
public static FilterCondition matchResourcePath(Pattern regex)
Returns aFilterCondition
which will only match requests whose resource path matches the provided regular expression.- Parameters:
regex
- The regular expression which must match a request's resource path.- Returns:
- The filter condition.
- See Also:
Request.getResourcePath()
-
matchResourcePath
public static FilterCondition matchResourcePath(String regex)
Returns aFilterCondition
which will only match requests whose resource path matches the provided regular expression.- Parameters:
regex
- The regular expression which must match a request's resource path.- Returns:
- The filter condition.
- See Also:
Request.getResourcePath()
-
not
public static FilterCondition not(FilterCondition condition)
Returns aFilterCondition
which will match requests which do not match the provided condition.- Parameters:
condition
- The condition which requests must not match.- Returns:
- The filter condition.
-
or
public static FilterCondition or(Collection<FilterCondition> conditions)
Returns aFilterCondition
which will match requests which match any of the provided conditions.- Parameters:
conditions
- The conditions which requests may match.- Returns:
- The filter condition.
-
or
public static FilterCondition or(FilterCondition... conditions)
Returns aFilterCondition
which will match requests which match any of the provided conditions.- Parameters:
conditions
- The conditions which requests may match.- Returns:
- The filter condition.
-
-