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

java.lang.Object
  extended by 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:

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.