| package com.google.inject.binder; |
| |
| import com.google.inject.Factory; |
| import com.google.inject.Key; |
| import com.google.inject.Scope; |
| import com.google.inject.TypeLiteral; |
| import java.lang.annotation.Annotation; |
| |
| /** |
| * TODO |
| */ |
| public interface BindingBuilder<T> { |
| |
| /** |
| * Specifies the annotation type for this binding. |
| */ |
| BindingBuilder<T> annotatedWith( |
| Class<? extends Annotation> annotationType); |
| |
| /** |
| * Specifies an annotation for this binding. |
| */ |
| BindingBuilder<T> annotatedWith(Annotation annotation); |
| |
| /** |
| * Binds to instances of the given implementation class. The |
| * {@link com.google.inject.Container} will inject the implementation instances as well. Sets |
| * the scope based on an annotation on the implementation class if present. |
| */ |
| <I extends T> BindingBuilder<T> to(Class<I> implementation); |
| |
| /** |
| * Binds to instances of the given implementation type. The |
| * {@link com.google.inject.Container} will inject the implementation instances as well. Sets |
| * the scope based on an annotation on the implementation class if present. |
| */ |
| <I extends T> BindingBuilder<T> to( |
| TypeLiteral<I> implementation); |
| |
| /** |
| * Binds to instances generated by the given factory. |
| */ |
| BindingBuilder<T> to(Factory<? extends T> factory); |
| |
| /** |
| * Binds to the given instance. |
| */ |
| BindingBuilder<T> to(T instance); |
| |
| /** |
| * Binds to instances from the factory bound to the given type. |
| */ |
| BindingBuilder<T> toFactory( |
| Class<? extends Factory<T>> factoryType); |
| |
| /** |
| * Binds to instances from the factory bound to the given type. |
| */ |
| BindingBuilder<T> toFactory( |
| TypeLiteral<? extends Factory<T>> factoryType); |
| |
| /** |
| * Binds to instances from the given generator bound to the given key. |
| */ |
| BindingBuilder<T> toFactory( |
| Key<? extends Factory<T>> factoryKey); |
| |
| /** |
| * Specifies the scope. References the annotation passed to {@link |
| * com.google.inject.BinderImpl#bindScope(Class, com.google.inject.Scope)}. |
| */ |
| BindingBuilder<T> in(Class<? extends Annotation> scopeAnnotation); |
| |
| /** |
| * Specifies the scope. |
| */ |
| BindingBuilder<T> in(Scope scope); |
| |
| /** |
| * 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. |
| */ |
| BindingBuilder<T> eagerly(); |
| } |