Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.inject.rebind.resolution
Class UnresolvedBindingValidator

    java.lang.Object
      com.google.gwt.inject.rebind.resolution.UnresolvedBindingValidator

    public class UnresolvedBindingValidator

extends java.lang.Object

Finds and reports errors in the dependency information. Removes all optional bindings that can't be constructed.

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:

- Circular dependencies that do not pass through a Provider or an AsyncProvider. This is a fatal error, even for optional keys.
- Bindings that cannot be created without causing a double-binding. Specifically, bindings for which the key is already bound below, but not exposed to, the Ginjector that needs the key. This is only an error for required keys; optional keys are removed.
- Bindings that cannot have implicit dependencies created for them. This is only an error if the key is required; optional keys are removed.

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.

Nested Class Summary
`static interface` | `UnresolvedBindingValidator.Factory`
`static class` | `UnresolvedBindingValidator.InvalidKeys` Container for information about invalid keys.

Constructor Summary
`UnresolvedBindingValidator(EagerCycleFinder cycleFinder, ErrorManager errorManager, com.google.gwt.core.ext.TreeLogger logger)`

Method Summary
`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).

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### UnresolvedBindingValidator

    @Inject
    public UnresolvedBindingValidator(EagerCycleFinder cycleFinder,
                                             ErrorManager errorManager,
                                             com.google.gwt.core.ext.TreeLogger logger)

Method Detail

### getInvalidKeys

    public 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.

### validate

    public 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). If there are any errors, they will be reported to the global `ErrorManager`.

### pruneInvalidOptional

    public void pruneInvalidOptional(DependencyExplorer.DependencyExplorerOutput output,
                                     UnresolvedBindingValidator.InvalidKeys invalidKeys)

  Prune all of the invalid optional keys from the graph. After this method, all of the keys remaining in the graph are resolvable.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD