Search in sources :

Example 26 with GinjectorBindings

use of com.google.gwt.inject.rebind.GinjectorBindings in project google-gin by gwtplus.

the class BindingInstaller method installBinding.

/**
 * Adds the given implicit binding in the graph to the injector hierarchy in the position
 * specified by the {@link BindingPositioner}. Also ensures that the dependencies of the implicit
 * binding are available at the chosen position.
 */
private void installBinding(DependencyGraph graph, Key<?> key, Binding binding) {
    // Figure out where we're putting the implicit entry
    GinjectorBindings implicitEntryPosition = positions.getInstallPosition(key);
    // Ensure that the dependencies are available to the ginjector
    inheritBindingsForDeps(implicitEntryPosition, graph.getDependenciesOf(key));
    // Now add the implicit binding to the ginjector
    implicitEntryPosition.addBinding(key, binding);
}
Also used : GinjectorBindings(com.google.gwt.inject.rebind.GinjectorBindings)

Example 27 with GinjectorBindings

use of com.google.gwt.inject.rebind.GinjectorBindings in project google-gin by gwtplus.

the class BindingInstaller method installBindings.

/**
 * Installs all of the implicit bindings as described {@link BindingInstaller above}.
 *
 * @param output {@link DependencyExplorerOutput} with information about the unresolved bindings
 *     for the current ginjector.
 */
public void installBindings(DependencyExplorerOutput output) {
    positions.position(output);
    // Install each implicit binding in the correct position
    for (Map.Entry<Key<?>, Binding> entry : output.getImplicitBindings()) {
        installBinding(output.getGraph(), entry.getKey(), entry.getValue());
    }
    // Make sure that each of the dependencies needed directly from the origin are available
    GinjectorBindings origin = output.getGraph().getOrigin();
    inheritBindingsForDeps(origin, origin.getDependencies());
}
Also used : Binding(com.google.gwt.inject.rebind.binding.Binding) ParentBinding(com.google.gwt.inject.rebind.binding.ParentBinding) GinjectorBindings(com.google.gwt.inject.rebind.GinjectorBindings) Map(java.util.Map) Key(com.google.inject.Key)

Aggregations

GinjectorBindings (com.google.gwt.inject.rebind.GinjectorBindings)27 Binding (com.google.gwt.inject.rebind.binding.Binding)10 Dependency (com.google.gwt.inject.rebind.binding.Dependency)8 ParentBinding (com.google.gwt.inject.rebind.binding.ParentBinding)7 ExposedChildBinding (com.google.gwt.inject.rebind.binding.ExposedChildBinding)6 DependencyExplorerOutput (com.google.gwt.inject.rebind.resolution.DependencyExplorer.DependencyExplorerOutput)6 Key (com.google.inject.Key)5 NameGenerator (com.google.gwt.inject.rebind.util.NameGenerator)3 LinkedHashMap (java.util.LinkedHashMap)3 Map (java.util.Map)3 Capture (org.easymock.Capture)3 GinjectorNameGenerator (com.google.gwt.inject.rebind.GinjectorNameGenerator)2 InjectorMethod (com.google.gwt.inject.rebind.util.InjectorMethod)2 SourceWriteUtil (com.google.gwt.inject.rebind.util.SourceWriteUtil)2 GeneratorContext (com.google.gwt.core.ext.GeneratorContext)1 GinModule (com.google.gwt.inject.client.GinModule)1 GinScope (com.google.gwt.inject.rebind.GinScope)1 GinModuleAdapter (com.google.gwt.inject.rebind.adapter.GinModuleAdapter)1 GinjectorBinding (com.google.gwt.inject.rebind.binding.GinjectorBinding)1 SubPackageClass (com.google.gwt.inject.rebind.output.subpackage.SubPackageClass)1