Package org.forgerock.util
Class BlackAndWhitelistFilter
java.lang.Object
org.forgerock.util.BlackAndWhitelistFilter
This class can be used for filtering string elements by using blacklists and/or whitelists.
Tested elements are permitted if:
- The whitelist is empty and the tested element does not match a blacklist entry.
- The tested element matches an entry in the whitelist and does not match a blacklist entry.
Once created, call test(String)
} to know if a String
is accepted by the filter.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionBlackAndWhitelistFilter
(Collection<Pattern> regExpBlacklist, Collection<Pattern> regExpWhitelist) Creates a newBlackAndWhitelistFilter
with provided collections. -
Method Summary
-
Constructor Details
-
BlackAndWhitelistFilter
public BlackAndWhitelistFilter(Collection<Pattern> regExpBlacklist, Collection<Pattern> regExpWhitelist) Creates a newBlackAndWhitelistFilter
with provided collections.
-
-
Method Details
-
test
Returnstrue
if the provided string is accepted by this filter,false
otherwise.A string value is excluded by the filter if the whitelist is non-empty and it is not in the whitelist, or if the string is in the blacklist.
-