com.google.inject
Class ContainerBuilder.BindingBuilder<T>

java.lang.Object
  extended by com.google.inject.ContainerBuilder.BindingBuilder<T>
Enclosing class:
ContainerBuilder

public class ContainerBuilder.BindingBuilder<T>
extends java.lang.Object

Binds a Key to an implementation in a given scope.


Method Summary
 ContainerBuilder.BindingBuilder<T> from(java.lang.Object source)
          Sets the source object.
 ContainerBuilder.BindingBuilder<T> in(Scope scope)
          Specifies the scope.
 ContainerBuilder.BindingBuilder<T> named(java.lang.String name)
          Sets the name of this binding.
<I extends T>
ContainerBuilder.BindingBuilder<T>
to(java.lang.Class<I> implementation)
          Binds to instances of the given implementation class.
 ContainerBuilder.BindingBuilder<T> to(ContextualFactory<? extends T> factory)
          Binds to instances from the given factory.
 ContainerBuilder.BindingBuilder<T> to(Factory<? extends T> factory)
          Binds to instances from the given factory.
<I extends T>
ContainerBuilder.BindingBuilder<T>
to(TypeToken<I> implementation)
          Binds to instances of the given implementation type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

from

public ContainerBuilder.BindingBuilder<T> from(java.lang.Object source)
Sets the source object. Useful for debugging. Contents may include the name of the file and the line number this binding came from, a code snippet, etc.


named

public ContainerBuilder.BindingBuilder<T> named(java.lang.String name)
Sets the name of this binding.


to

public <I extends T> ContainerBuilder.BindingBuilder<T> to(java.lang.Class<I> implementation)
Binds to instances of the given implementation class. The Container will inject the implementation instances as well. Sets the scope based on the @Scoped annotation on the implementation class if present.


to

public <I extends T> ContainerBuilder.BindingBuilder<T> to(TypeToken<I> implementation)
Binds to instances of the given implementation type. The Container will inject the implementation instances as well. Sets the scope based on the @Scoped annotation on the implementation class if present.


to

public ContainerBuilder.BindingBuilder<T> to(ContextualFactory<? extends T> factory)
Binds to instances from the given factory.


to

public ContainerBuilder.BindingBuilder<T> to(Factory<? extends T> factory)
Binds to instances from the given factory.


in

public ContainerBuilder.BindingBuilder<T> in(Scope scope)
Specifies the scope.