| Modifier and Type | Field and Description |
|---|---|
static Rule |
DEFAULT_ALLOW
A default ALLOW rule that matches everything.
|
static Rule |
DEFAULT_DENY
A default DENY rule that matches everything.
|
static Rule |
DEFAULT_EXCLUDE
A default EXCLUDE rule that matches everything.
|
static Rule |
DEFAULT_INCLUDE
A default INCLUDE rule that matches everything.
|
| Modifier and Type | Method and Description |
|---|---|
static Rule |
fromJson(javax.json.JsonObject ruleJson)
Construct a single rule from a JSON object with keys
type and pattern. |
static List<Rule> |
fromJsonArray(javax.json.JsonArray rulesArray)
Conveniently creates a list of Rules from the conventional use case of a JSON array containing a list of rule
JSON objects to be evaluated in sequence.
|
static Rule |
fuzzyDefaultAllow(List<Rule> rules)
Return
DEFAULT_ALLOW, unless first element in rules list is an explicit allow, in which
case return DEFAULT_DENY. |
static Rule |
fuzzyDefaultDeny(List<Rule> rules)
Return
DEFAULT_DENY, unless first element in rules list is an explicit deny, in which
case return DEFAULT_ALLOW. |
static Rule |
fuzzyDefaultExclude(List<Rule> rules)
Return
DEFAULT_EXCLUDE, unless first element in rules list is an explicit exclude, in which
case return DEFAULT_INCLUDE. |
static Rule |
fuzzyDefaultInclude(List<Rule> rules)
Return
DEFAULT_INCLUDE, unless first element in rules list is an explicit include, in which
case return DEFAULT_EXCLUDE. |
static Rule |
lastMatch(List<Rule> rules,
String value)
Evaluate the provided list of rules against the String value, using
fuzzyDefaultInclude(List) to select
the default rule when none match. |
static Rule |
lastMatch(List<Rule> rules,
String value,
Function<List<Rule>,Rule> selectDefault)
Evaluate the provided list of rules against the String value using the provided selector function to select the
default rule when none match.
|
public static final Rule DEFAULT_DENY
public static final Rule DEFAULT_ALLOW
public static final Rule DEFAULT_EXCLUDE
public static final Rule DEFAULT_INCLUDE
public static List<Rule> fromJsonArray(javax.json.JsonArray rulesArray)
rulesArray - a JSON array where calling fromJson(JsonObject) on each element will construct a
valid Rulepublic static Rule fromJson(javax.json.JsonObject ruleJson)
type and pattern.ruleJson - a single rule config objectpublic static Rule fuzzyDefaultAllow(List<Rule> rules)
DEFAULT_ALLOW, unless first element in rules list is an explicit allow, in which
case return DEFAULT_DENY.rules - rules listDEFAULT_ALLOW, but sometimes DEFAULT_DENYpublic static Rule fuzzyDefaultDeny(List<Rule> rules)
DEFAULT_DENY, unless first element in rules list is an explicit deny, in which
case return DEFAULT_ALLOW.rules - rules listDEFAULT_EXCLUDE, but sometimes DEFAULT_INCLUDEpublic static Rule fuzzyDefaultInclude(List<Rule> rules)
DEFAULT_INCLUDE, unless first element in rules list is an explicit include, in which
case return DEFAULT_EXCLUDE.rules - rules listDEFAULT_INCLUDE, but sometimes DEFAULT_EXCLUDEpublic static Rule fuzzyDefaultExclude(List<Rule> rules)
DEFAULT_EXCLUDE, unless first element in rules list is an explicit exclude, in which
case return DEFAULT_INCLUDE.rules - rules listDEFAULT_EXCLUDE, but sometimes DEFAULT_INCLUDEpublic static Rule lastMatch(List<Rule> rules, String value, Function<List<Rule>,Rule> selectDefault)
rules - a list of rules to match against the value. the last one to match, if any, is returned.value - the string value to match against.selectDefault - a function to select the default rule based on the specified list of rules.public static Rule lastMatch(List<Rule> rules, String value)
fuzzyDefaultInclude(List) to select
the default rule when none match.rules - a list of rules to match against the value. the last one to match, if any, is returned.value - the string value to match against.Copyright © 2017–2020. All rights reserved.