public class DependencySolverBuilder extends Object
DependencySolver
s.DependencySolver.newBuilder()
Constructor and Description |
---|
DependencySolverBuilder() |
Modifier and Type | Method and Description |
---|---|
DependencySolverBuilder |
addBindingFunction(BindingFunction func)
Add a binding function to the dependency solver.
|
DependencySolverBuilder |
addBindingFunction(BindingFunction func,
boolean canTriggerRewrite)
Add a binding function to the dependency solver.
|
DependencySolverBuilder |
addBindingFunctions(BindingFunction... funcs)
Add multiple binding function to the dependency solver.
|
DependencySolverBuilder |
addBindingFunctions(Iterable<BindingFunction> funcs)
Add multiple binding function to the dependency solver.
|
DependencySolver |
build()
Build a dependency solver.
|
List<BindingFunction> |
getBindingFunctions()
Get the current list of binding functions.
|
CachePolicy |
getDefaultPolicy()
Get the current default policy.
|
int |
getMaxDepth()
Get the maximum depth.
|
List<BindingFunction> |
getTriggerFunctions()
Get the current list of trigger binding functions.
|
DependencySolverBuilder |
setDefaultPolicy(CachePolicy policy)
Set the default policy for the solver.
|
DependencySolverBuilder |
setMaxDepth(int depth)
Set the maximum object graph depth, for cycle detection.
|
public List<BindingFunction> getBindingFunctions()
public List<BindingFunction> getTriggerFunctions()
canTriggerRewrite
is true
in addBindingFunction(BindingFunction,boolean)
.public DependencySolverBuilder addBindingFunction(@Nonnull BindingFunction func)
func
- The binding function.public DependencySolverBuilder addBindingFunction(@Nonnull BindingFunction func, boolean canTriggerRewrite)
func
- The binding function.canTriggerRewrite
- Controls whether this binding function can activate re-resolution
when doing a graph rewrite. If true
(the value passed by
all other binding function adders), this binding function returning
a binding will cause a graph rewrite; if false
, it will be
ignored during rewrites until the rewrite has been triggered by some
other binding function. Register the default binding function with
false
here to keep default bindings from triggering rewrites.public DependencySolverBuilder addBindingFunctions(@Nonnull BindingFunction... funcs)
funcs
- The binding functions.public DependencySolverBuilder addBindingFunctions(@Nonnull Iterable<BindingFunction> funcs)
funcs
- The binding functions.public CachePolicy getDefaultPolicy()
public DependencySolverBuilder setDefaultPolicy(CachePolicy policy)
CachePolicy.NO_PREFERENCE
. The default is CachePolicy.NO_PREFERENCE
,
so the injector will make final caching decisions.policy
- The default policy for the solver.public int getMaxDepth()
public DependencySolverBuilder setMaxDepth(int depth)
depth
- The maximum object graph depth that the solver is allowed to produce.public DependencySolver build()
Copyright © 2016 GroupLens Research. All rights reserved.