T - the concrete type of the attribute@Incubating public interface DisambiguationRuleChain<T>
A chain of disambiguation rules. By default the chain is empty and will not do any disambiguation.
For a given set of rules, the execution is done in order, and interrupts as soon as a rule
selected at least one candidate (through MultipleCandidatesDetails.closestMatch(Object)).
If the end of the rule chain is reached and that no rule selected a candidate then the candidate list is returned unmodified, meaning we still have an ambiguous match.
| Modifier and Type | Method and Description |
|---|---|
void |
add(Class<? extends AttributeDisambiguationRule<T>> rule)
Adds an arbitrary disambiguation rule to the chain.
|
void |
add(Class<? extends AttributeDisambiguationRule<T>> rule,
Action<? super ActionConfiguration> configureAction)
Adds an arbitrary disambiguation rule to the chain, possibly configuring the rule as well.
|
void |
pickFirst(Comparator<? super T> comparator)
Adds an ordered disambiguation rule.
|
void |
pickLast(Comparator<? super T> comparator)
Adds an ordered disambiguation rule.
|
void add(Class<? extends AttributeDisambiguationRule<T>> rule)
Adds an arbitrary disambiguation rule to the chain.
A disambiguation rule can select the best match from a list of candidates.
A rule can express an preference by calling the @{link MultipleCandidatesDetails.closestMatch(Object)
method to tell that a candidate is the best one.
It is not mandatory for a rule to choose, and it is not an error to select multiple candidates.
rule - the rule to addvoid add(Class<? extends AttributeDisambiguationRule<T>> rule, Action<? super ActionConfiguration> configureAction)
Adds an arbitrary disambiguation rule to the chain, possibly configuring the rule as well.
rule - the rule to addconfigureAction - the action to use to configure the rulevoid pickFirst(Comparator<? super T> comparator)
comparator - the comparator to usevoid pickLast(Comparator<? super T> comparator)
comparator - the comparator to use