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

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


   * other code necessary to support it.  Produces a list of helper methods that
   * still need to be written.
   */
  void writeBindingGetter(Key<?> key, Binding binding, GinScope scope,
      List<InjectorMethod> helperMethodsOutput) {
    Context bindingContext = binding.getContext();

    SourceSnippetBuilder getterBuilder = new SourceSnippetBuilder();
    SourceSnippet creationStatements;
    String getter = nameGenerator.getGetterMethodName(key);

View Full Code Here


    this.bindingsCollection = bindingsCollection;
    this.bindingFactory = bindingFactory;
  }

  public Void visit(ProviderKeyBinding<? extends T> providerKeyBinding) {
    Context context = Context.forElement(providerKeyBinding);
    bindingsCollection.addBinding(
        targetKey,
        bindingFactory.getBindProviderBinding(
            providerKeyBinding.getProviderKey(), providerKeyBinding.getKey(), context));
View Full Code Here

    // Detect provider methods and handle them
    // TODO(bstoler): Update this when the SPI explicitly has a case for
    // provider methods
    Provider<? extends T> provider = providerInstanceBinding.getProviderInstance();
    if (provider instanceof ProviderMethod) {
      Context context = Context.forElement(providerInstanceBinding);
      bindingsCollection.addBinding(targetKey,
          bindingFactory.getProviderMethodBinding((ProviderMethod<?>) provider, context));
      return null;
    }
View Full Code Here

    // OTt, use the normal default handler (and error)
    return super.visit(providerInstanceBinding);
  }

  public Void visit(LinkedKeyBinding<? extends T> linkedKeyBinding) {
    Context context = Context.forElement(linkedKeyBinding);
    bindingsCollection.addBinding(targetKey,
        bindingFactory.getBindClassBinding(linkedKeyBinding.getLinkedKey(), targetKey, context));
    return null;
  }
View Full Code Here

  }

  public Void visit(InstanceBinding<? extends T> instanceBinding) {
    T instance = instanceBinding.getInstance();
    if (BindConstantBinding.isConstantKey(targetKey)) {
      Context context = Context.forElement(instanceBinding);
      bindingsCollection.addBinding(targetKey,
          bindingFactory.getBindConstantBinding(targetKey, instance, context));
    } else {
      messages.add(new Message(instanceBinding.getSource(),
          PrettyPrinter.format("Instance binding not supported; key=%s, inst=%s",
View Full Code Here

  private void ensureAccessible(Key<?> key, GinjectorBindings parent, GinjectorBindings child) {
    // Parent will be null if it is was an optional dependency and it couldn't be created.
    if (parent != null && !child.equals(parent) && !child.isBound(key)) {
      PrettyPrinter.log(logger, TreeLogger.DEBUG,
          "In %s: inheriting binding for %s from the parent %s", child, key, parent);
      Context context = Context.format("Inheriting %s from parent", key);

      // We don't strictly need all the extra checks in addBinding, but it can't hurt.  We know, for
      // example, that there will not be any unresolved bindings for this key.
      child.addBinding(key, bindingFactory.getParentBinding(key, parent, context));
    }
View Full Code Here

TOP

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

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.