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 Object

Binds a Key to an implementation in a given scope.


Method Summary
 ContainerBuilder.BindingBuilder<T> annotatedWith(Annotation annotation)
          Specifies an annotation for this binding.
 ContainerBuilder.BindingBuilder<T> annotatedWith(Class<? extends Annotation> annotationType)
          Specifies the annotation type for this binding.
 ContainerBuilder.BindingBuilder<T> in(Class<? extends Annotation> scopeAnnotation)
          Specifies the scope.
 ContainerBuilder.BindingBuilder<T> in(Scope scope)
          Specifies the scope.
 ContainerBuilder.BindingBuilder<T> preload()
          Instructs the builder to eagerly load this binding when it creates the container.
<I extends T>
ContainerBuilder.BindingBuilder<T>
to(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.
 ContainerBuilder.BindingBuilder<T> to(T instance)
          Binds to the given instance.
<I extends T>
ContainerBuilder.BindingBuilder<T>
to(TypeLiteral<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

annotatedWith

public ContainerBuilder.BindingBuilder<T> annotatedWith(Class<? extends Annotation> annotationType)
Specifies the annotation type for this binding.


annotatedWith

public ContainerBuilder.BindingBuilder<T> annotatedWith(Annotation annotation)
Specifies an annotation for this binding.


to

public <I extends T> ContainerBuilder.BindingBuilder<T> to(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 an annotation on the implementation class if present.


to

public <I extends T> ContainerBuilder.BindingBuilder<T> to(TypeLiteral<I> implementation)
Binds to instances of the given implementation type. The Container will inject the implementation instances as well. Sets the scope based on an 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.


to

public ContainerBuilder.BindingBuilder<T> to(T instance)
Binds to the given instance.


in

public ContainerBuilder.BindingBuilder<T> in(Class<? extends Annotation> scopeAnnotation)
Specifies the scope. References the annotation passed to ContainerBuilder.scope(Class, Scope).


in

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


preload

public ContainerBuilder.BindingBuilder<T> preload()
Instructs the builder to eagerly load this binding when it creates the container. Useful for application initialization logic. Currently only supported for container-scoped bindings.