V - is the generic type of the value to check.public class FilterRuleChain<V> extends Object implements Filter<V>
Filter that is based on a chain of FilterRules.| Modifier and Type | Field and Description |
|---|---|
private boolean |
defaultResult |
private String |
id |
private FilterRuleChain<V> |
parent
The parent that is extended by this chain or
null. |
private FilterRule<V>[] |
rules
the rules
|
| Constructor and Description |
|---|
FilterRuleChain()
The non-arg constructor.
|
FilterRuleChain(boolean defaultResult,
FilterRule<V>... rules)
The constructor.
|
FilterRuleChain(String id,
FilterRuleChain<V> parent,
boolean defaultResult,
FilterRule<V>... rules)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(V value)
This method determines if the given
value should be accepted. |
private Boolean |
acceptRecursive(V value)
This method implements
accept(Object) recursively. |
FilterRuleChain<V> |
extend(boolean newDefaultResult,
FilterRule<V>... additionalRules)
This method extends this chain with
additionalRules. |
boolean |
getDefaultResult()
This method gets the default
result used if none of the rules matched. |
String |
getId()
This method gets the ID used to identify this chain.
|
String |
toString() |
private FilterRuleChain<V> parent
null.private FilterRule<V>[] rules
private boolean defaultResult
getDefaultResult()public FilterRuleChain()
@SafeVarargs public FilterRuleChain(boolean defaultResult, FilterRule<V>... rules)
defaultResult - is the result if none of the rules match.rules - is the chain of rules.@SafeVarargs public FilterRuleChain(String id, FilterRuleChain<V> parent, boolean defaultResult, FilterRule<V>... rules)
public boolean getDefaultResult()
result used if none of the rules matched.public boolean accept(V value)
value should be accepted.
This method checks all rules in the chain and returns the result of the first matching rule. If no rule matches,
getDefaultResult() is returned.private Boolean acceptRecursive(V value)
accept(Object) recursively.value - is the value to filter.true if the value is accepted, false if the value is NOT accepted, or
null if no decision is made.public FilterRuleChain<V> extend(boolean newDefaultResult, FilterRule<V>... additionalRules)
additionalRules.newDefaultResult - is the result of the new extended chain if none of the rules match.additionalRules - are the rules to add.additionalRules if none of this rules match.public String getId()
null if undefined.Copyright © 2001–2015 mmm-Team. All rights reserved.