public class UnresolvedBindingValidator extends Object
A key is required if there exists a path from a key in the unresolved set of the origin Ginjector to the key in question that passes only through required dependencies. A key is optional if every path that leads to the key contains an optional dependency. This detects the following:
Optional bindings with errors must be removed from the dependency graph before proceeding. This is to prevent them from incorrectly constraining the positions for keys that depend on them.
See BindingResolver
for how this fits into the overall algorithm for resolution.
Modifier and Type | Class and Description |
---|---|
static interface |
UnresolvedBindingValidator.Factory |
static class |
UnresolvedBindingValidator.InvalidKeys
Container for information about invalid keys.
|
Constructor and Description |
---|
UnresolvedBindingValidator(EagerCycleFinder cycleFinder,
ErrorManager errorManager,
TreeLogger logger) |
Modifier and Type | Method and Description |
---|---|
UnresolvedBindingValidator.InvalidKeys |
getInvalidKeys(DependencyExplorer.DependencyExplorerOutput output)
Returns an
UnresolvedBindingValidator.InvalidKeys object containing information about all the errors that we
discovered in required keys, and the set of all optional bindings that should be removed from
the graph in order to make it valid. |
void |
pruneInvalidOptional(DependencyExplorer.DependencyExplorerOutput output,
UnresolvedBindingValidator.InvalidKeys invalidKeys)
Prune all of the invalid optional keys from the graph.
|
boolean |
validate(DependencyExplorer.DependencyExplorerOutput output,
UnresolvedBindingValidator.InvalidKeys invalidKeys)
Returns true if the graph is valid (does not have any cycles or problems creating required
keys).
|
@Inject public UnresolvedBindingValidator(EagerCycleFinder cycleFinder, ErrorManager errorManager, TreeLogger logger)
public UnresolvedBindingValidator.InvalidKeys getInvalidKeys(DependencyExplorer.DependencyExplorerOutput output)
UnresolvedBindingValidator.InvalidKeys
object containing information about all the errors that we
discovered in required keys, and the set of all optional bindings that should be removed from
the graph in order to make it valid.public boolean validate(DependencyExplorer.DependencyExplorerOutput output, UnresolvedBindingValidator.InvalidKeys invalidKeys)
ErrorManager
.public void pruneInvalidOptional(DependencyExplorer.DependencyExplorerOutput output, UnresolvedBindingValidator.InvalidKeys invalidKeys)
Copyright © 2008–2018. All rights reserved.