Package com.google.gwt.inject.rebind.binding

Examples of com.google.gwt.inject.rebind.binding.Binding


    GinjectorBindings origin = output.getGraph().getOrigin();
    for (Key<?> key : output.getImplicitlyBoundKeys()) {
      if (origin.isBoundLocallyInChild(key)) {

        GinjectorBindings child = origin.getChildWhichBindsLocally(key);
        Binding childBinding = child.getBinding(key);

        PrettyPrinter.log(logger, TreeLogger.DEBUG,
            "Marking the key %s as bound in the ginjector %s (implicitly), and in the child"
                + " %s (%s)", key, origin, child, childBinding.getContext());

        // TODO(schmitt): Determine path to binding in child ginjector (requires
        // different DependencyExplorerOutput).
        invalidKeys.put(key,
            PrettyPrinter.format("Already bound in child Ginjector %s. Consider exposing it?",
View Full Code Here


        PrettyPrinter.log(logger, TreeLogger.DEBUG, "Using binding of %s in %s.", key,
            accessibleSource);
        output.preExistingBindings.put(key, accessibleSource);
      } else {
        try {
          Binding binding = bindingCreator.create(key);
          PrettyPrinter.log(logger, TreeLogger.DEBUG, "Implicitly bound %s in %s using %s.", key,
              origin, binding);
         
          for (Dependency edge : binding.getDependencies()) {
            PrettyPrinter.log(logger, TreeLogger.DEBUG, "Following %s", edge);
            builder.addEdge(edge);
            visit(edge.getTarget(), builder, output, origin);
          }
         
View Full Code Here

    private GinjectorBindings childLR;
    private GinjectorBindings childR;
  }
 
  private void bind(Key<?> key, GinjectorBindings in) {
    Binding binding = control.createMock(Binding.class);
    expect(binding.getContext()).andReturn(Context.forText("")).anyTimes();
    expect(in.isBound(key)).andReturn(true).anyTimes();
    expect(in.getBinding(key)).andReturn(binding).anyTimes();
    bindings.add(binding);
  }
View Full Code Here

  }
 
  public void testResolveDependenciesInRoot() throws Exception {
    StandardTree tree = createExampleTree();

    Binding fooBinding = expectCreateBinding(foo(), required(foo(), bar()), required(foo(), baz()));
    bind(bar(), tree.root);
    bind(baz(), tree.root);
   
    tree.root.addBinding(foo(), fooBinding);
    expectParentBinding(foo(), tree.root, tree.childLL);
View Full Code Here

 
  public void testResolveDependenciesInRoot_InheritedByChild() throws Exception {
    StandardTree tree = createExampleTree();
   
    // Bar already in root, inherited in childL.  Baz already in root.  Foo can still be in root.
    Binding fooBinding = expectCreateBinding(foo(), required(foo(), bar()), required(foo(), baz()));
    bind(bar(), tree.root);
    bindParent(bar(), tree.root, tree.childL);
    bind(baz(), tree.root);
   
View Full Code Here

    StandardTree tree = createExampleTree();
    // Bar is bound in the child, but exposed to the root.  Foo should still be in root
    bind(bar(), tree.childR);
    bindChild(bar(), tree.root, tree.childR);
    bind(baz(), tree.root);
    Binding fooBinding = expectCreateBinding(foo(), required(foo(), bar()), required(foo(), baz()));

    tree.root.addBinding(foo(), fooBinding);
    expectParentBinding(foo(), tree.root, tree.childR);

    replayAndResolve(tree.childR, required(Dependency.GINJECTOR, foo()));
View Full Code Here

  public void testResolveDependenciesResolveInOriginExposedToParent() throws Exception {
    StandardTree tree = createExampleTree();
    // Bar is bound in the child, but exposed to the root.  Foo should still be in root
    bindChild(bar(), tree.root, tree.childR);
    bind(baz(), tree.root);
    Binding fooBinding = expectCreateBinding(foo(), required(foo(), bar()), required(foo(), baz()));
    Binding barBinding = expectCreateBinding(bar());

    tree.root.addBinding(foo(), fooBinding);
    tree.childR.addBinding(bar(), barBinding);
    expectParentBinding(foo(), tree.root, tree.childR);
View Full Code Here

    StandardTree tree = createExampleTree();
    // Bar is bound in the child, but exposed to the root.  Foo should still be in root
    bind(bar(), tree.childL);
    bindChild(bar(), tree.root, tree.childL);
    bind(baz(), tree.root);
    Binding fooBinding = expectCreateBinding(foo(), required(foo(), bar()), required(foo(), baz()));

    tree.root.addBinding(foo(), fooBinding);
    expectParentBinding(foo(), tree.root, tree.childLL);
       
    replayAndResolve(tree.childLL, required(Dependency.GINJECTOR, foo()));
View Full Code Here

 
  public void testResolveOneDependencyInChildL() throws Exception {
    StandardTree tree = createExampleTree();
    bind(bar(), tree.root);
    bind(baz(), tree.childL);
    Binding fooBinding = expectCreateBinding(foo(), required(foo(), bar()), required(foo(), baz()));
   
    expectParentBinding(bar(), tree.root, tree.childL); // childL gets Bar from root
    tree.childL.addBinding(foo(), fooBinding);
    expectParentBinding(foo(), tree.childL, tree.childLL); // childLL gets foo from childL
       
View Full Code Here

  }
 
  public void testResolveBindingWithOptionalDependency_DepFails() throws Exception{
    StandardTree tree = createExampleTree();
    // Baz is optional and fails to resolve
    Binding fooBinding = expectCreateBinding(foo(), required(foo(), bar()), optional(foo(), baz()));
    expect(bindingCreator.create(baz())).andThrow(new BindingCreationException("Unable to create"));
    bind(bar(), tree.root);

    tree.root.addBinding(foo(), fooBinding);
    expectParentBinding(foo(), tree.root, tree.childLL); // childLL gets foo from childL
View Full Code Here

TOP

Related Classes of com.google.gwt.inject.rebind.binding.Binding

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.