Examples of GinjectorBindings


Examples of com.google.gwt.inject.rebind.GinjectorBindings

    // node (if its optional).
    for (Entry<Key<?>, String> error : output.getBindingErrors()) {
      invalidKeys.put(error.getKey(), "Unable to create or inherit binding: " + error.getValue());
    }
   
    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());
View Full Code Here

Examples of com.google.gwt.inject.rebind.GinjectorBindings

  }
  private void visit(Key<?> key, DependencyGraph.Builder builder,
      DependencyExplorerOutput output, GinjectorBindings origin) {
    if (visited.add(key)) {
      GinjectorBindings accessibleSource = locateHighestAccessibleSource(key, origin);
      if (accessibleSource != null) {
        PrettyPrinter.log(logger, TreeLogger.DEBUG, "Using binding of %s in %s.", key,
            accessibleSource);
        output.preExistingBindings.put(key, accessibleSource);
      } else {
View Full Code Here

Examples of com.google.gwt.inject.rebind.GinjectorBindings

    // null so that we attempt to create the implicit binding.
    if (!origin.isBound(key) && origin.isPinned(key)) {
      return null;
    }

    GinjectorBindings source = null;
    for (GinjectorBindings iter = origin; iter != null; iter = iter.getParent()) {
      // If the key is already explicitly bound, or has a pin indicating that it
      // will be explicitly bound once it gets visited (we visit children before
      // parents) then we can access the binding from the given location.
      if (iter.isBound(key) || iter.isPinned(key)) {
View Full Code Here

Examples of com.google.gwt.inject.rebind.GinjectorBindings

        bindingInstallerFactory,
        treeLogger);
  }
 
  private GinjectorBindings createInjectorNode(String name) {
    GinjectorBindings node = control.createMock(name, GinjectorBindings.class);
    nodes.add(node);
    expect(node.getParent()).andStubReturn(null);
    expect(node.getChildren()).andStubReturn(new ArrayList<GinjectorBindings>());
    expect(node.isBound(isA(Key.class))).andStubReturn(false);
    expect(node.isBoundLocallyInChild(isA(Key.class))).andStubReturn(false);
    expect(node.getBinding(isA(Key.class))).andStubReturn(null);
    expect(node.getModuleName()).andStubReturn(name);
    expect(node.isPinned(isA(Key.class))).andStubReturn(false);
    return node;
  }
View Full Code Here

Examples of com.google.gwt.inject.rebind.GinjectorBindings

    errorManager.logError(isA(String.class), eq(bar()), isA(String.class), isA(List.class));
    replayAndResolve(tree.childLL, required(Dependency.GINJECTOR, foo()));
  }
 
  public void testCircularDependency() throws Exception {
    GinjectorBindings root = createInjectorNode("root");
   
    expectCreateBinding(bar(), required(bar(), baz()));
    expectCreateBinding(baz(), required(baz(), bar()));
   
    Capture<String> errorMessage = new Capture<String>();
View Full Code Here

Examples of com.google.gwt.inject.rebind.GinjectorBindings

    // Intentionally use a different key, so that == won't work
    replayAndResolve(root, required(Dependency.GINJECTOR, bar()));
  }
 
  public void testCycleDetectionForBindFooToFooImpl() throws Exception {
    GinjectorBindings root = createInjectorNode("root");
   
    bind(foo(), root);
    expectCreateBinding(fooImpl(), required(fooImpl(), bar()));
    expectCreateBinding(bar(), required(bar(), foo()));
   
View Full Code Here

Examples of com.google.gwt.inject.rebind.GinjectorBindings

    // Intentionally use a different key, so that == won't work
    replayAndResolve(root, required(foo(), fooImpl()));
  }
 
  public void testOneNode() throws Exception {
    GinjectorBindings root = createInjectorNode("root");
    Binding fooBinding = expectCreateBinding(foo(), required(foo(), bar()), required(foo(), baz()));
    bind(bar(), root);
    bind(baz(), root);
    root.addBinding(foo(), fooBinding);
       
    replayAndResolve(root, required(Dependency.GINJECTOR, foo()));
  }
View Full Code Here

Examples of com.google.gwt.inject.rebind.GinjectorBindings

  public void testDependencyInOtherChild() throws Exception {
    // Test one of the "weird" behaviors in Guice. Foo depends on Bar and Baz.  Because
    // Bar is bound in a sibling, we can't create Bar in the parent.  Therefore,
    // we create Bar (and Foo) in the origin
    GinjectorBindings root = createInjectorNode("root");
    GinjectorBindings childL = createInjectorNode("childL");
    GinjectorBindings childR = createInjectorNode("childR");
    setChildren(root, childL, childR);
   
    bind(baz(), root);
    bind(bar(), childL);
    expect(root.isBoundLocallyInChild(bar())).andReturn(true).anyTimes();
   
    Binding fooBinding = expectCreateBinding(foo(), required(foo(), bar()), required(foo(), baz()));
    Binding barBinding = expectCreateBinding(bar());
   
    childR.addBinding(bar(), barBinding);
    expectParentBinding(baz(), root, childR);
    childR.addBinding(foo(), fooBinding);
       
    replayAndResolve(childR, required(Dependency.GINJECTOR, foo()));
  }
View Full Code Here

Examples of com.google.gwt.inject.rebind.GinjectorBindings

       
    replayAndResolve(childR, required(Dependency.GINJECTOR, foo()));
  }
 
  public void testDepHiddenInChildBlocksResolvingInRoot() throws Exception {
    GinjectorBindings root = createInjectorNode("root");
    GinjectorBindings child = createInjectorNode("child_module");
    setChildren(root, child);
   
    bind(baz(), root);
    bind(bar(), child);
    expect(root.isBoundLocallyInChild(bar())).andReturn(true).anyTimes();
View Full Code Here

Examples of com.google.gwt.inject.rebind.GinjectorBindings

    assertTrue(errorMessage.getValue().contains("child_module"));
  }
 
  public void testDepHiddenInChildBlocksResolvingInRoot_NoErrorIfOptional() throws Exception {
    GinjectorBindings root = createInjectorNode("root");
    GinjectorBindings child = createInjectorNode("child");
    setChildren(root, child);
   
    bind(baz(), root);
    bind(bar(), child);
    expect(root.isBoundLocallyInChild(bar())).andReturn(true).anyTimes();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.