Class RegexRuleSet
java.lang.Object
com.netflix.genie.common.internal.util.RegexRuleSet
Utility class to match a string against an ordered set of regexes and obtain an accept/reject response.
- Since:
- 4.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Ruleset builder.static enum
The two responses to an input.static final class
An individual rule in a ruleset. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Evaluate an input string against the ruleset for acceptance.static RegexRuleSet
buildBlacklist
(String... patternStrings) Factory method to build a whitelist ruleset.static RegexRuleSet
buildBlacklist
(Pattern... patterns) Factory method to build a whitelist ruleset.static RegexRuleSet
buildWhitelist
(String... patternStrings) Factory method to build a whitelist ruleset.static RegexRuleSet
buildWhitelist
(Pattern... patterns) Factory method to build a whitelist ruleset.Evaluate an input string against the rule set.boolean
Evaluate an input string against the ruleset for rejection.
-
Method Details
-
buildWhitelist
Factory method to build a whitelist ruleset. (Whitelist rejects everything except for the given patterns).- Parameters:
patternStrings
- a set of pattern strings that constitute the whitelist- Returns:
- the ruleset
-
buildWhitelist
Factory method to build a whitelist ruleset. (Whitelist rejects everything except for the given patterns).- Parameters:
patterns
- a set of patterns that constitute the whitelist- Returns:
- the ruleset
-
buildBlacklist
Factory method to build a whitelist ruleset. (Blacklist accepts everything except for the given patterns).- Parameters:
patternStrings
- a set of pattern strings that constitute the blacklist- Returns:
- the ruleset
-
buildBlacklist
Factory method to build a whitelist ruleset. (Blacklist accepts everything except for the given patterns).- Parameters:
patterns
- a set of patterns that constitute the blacklist- Returns:
- the ruleset
-
evaluate
Evaluate an input string against the rule set.- Parameters:
input
- an input string- Returns:
- a response
-
accept
Evaluate an input string against the ruleset for acceptance.- Parameters:
input
- an input string- Returns:
- true if the response for this input is ACCEPT, false otherwise
-
reject
Evaluate an input string against the ruleset for rejection.- Parameters:
input
- an input string- Returns:
- true if the response for this input is REJECT, false otherwise
-