public class RuleBasedBindingFunction extends Object implements BindingFunction
BindingFunction that uses BindRules created by the fluent API to bind desires to other desires or satisfactions.
For more details on context management, see
QualifierMatcher. This function uses the
context to activate and select BindRules. A number of rules are used to order
applicable BindRules and choose the best. When any of these rules rely on the
current dependency context, the deepest node in the context has the most
influence. Put another way, if contexts were strings, they could be ordered
lexicographically from the right to the left.
When selecting BindRules to apply to a Desire, BindRules are ordered first by context match, then by the ordering defined by the bind rule itself.
A summary of these rules is that the best specified BindRule is applied, where the context that the BindRule is activated in has more priority than the type of the BindRule. If multiple rules tie for best, then the solver fails with a checked exception.
|Constructor and Description|
|Modifier and Type||Method and Description|
Find the applicable binding, if any, for a desire in a particular context.
Get the rules underlying this binding function.
public com.google.common.collect.ListMultimap<ContextMatcher,BindRule> getRules()
public BindingResult bind(InjectionContext context, DesireChain desire) throws ResolutionException
Copyright © 2016 GroupLens Research. All rights reserved.