com.google.inject
Interface Binder


public interface Binder

Used by Module implementations to configure bindings.


Method Summary
<T> BindingBuilder<T>
bind(Class<T> type)
          Creates a binding to a type.
<T> BindingBuilder<T>
bind(Key<T> key)
          Creates a binding to a key.
<T> BindingBuilder<T>
bind(TypeLiteral<T> typeLiteral)
          Creates a binding to a type.
 ConstantBindingBuilder bindConstant(Annotation annotation)
          Binds a constant value to an annotation.
 ConstantBindingBuilder bindConstant(Class<? extends Annotation> annotationType)
          Binds a constant value to an annotation.
 void bindInterceptor(Matcher<? super Class<?>> classMatcher, Matcher<? super Method> methodMatcher, MethodInterceptor... interceptors)
          Binds a method interceptor to methods matched by class and method matchers.
 void bindScope(Class<? extends Annotation> annotationType, Scope scope)
          Binds a scope to an annotation.
 void install(Module module)
          Uses the given module to configure more bindings.
<T> LinkedBindingBuilder<T>
link(Class<T> type)
          Links a type to another binding.
<T> LinkedBindingBuilder<T>
link(Key<T> key)
          Links a key to another binding.
<T> LinkedBindingBuilder<T>
link(TypeLiteral<T> type)
          Links a type to another binding.
 void requestStaticInjection(Class<?>... types)
          Upon successful creation, the Container will inject static fields and methods in the given classes.
 

Method Detail

bindInterceptor

void bindInterceptor(Matcher<? super Class<?>> classMatcher,
                     Matcher<? super Method> methodMatcher,
                     MethodInterceptor... interceptors)
Binds a method interceptor to methods matched by class and method matchers.

Parameters:
classMatcher - matches classes the interceptor should apply to. For example: only(Runnable.class).
methodMatcher - matches methods the interceptor should apply to. For example: annotatedWith(Transactional.class).
interceptors - to bind

bindScope

void bindScope(Class<? extends Annotation> annotationType,
               Scope scope)
Binds a scope to an annotation.


bind

<T> BindingBuilder<T> bind(Key<T> key)
Creates a binding to a key.


bind

<T> BindingBuilder<T> bind(TypeLiteral<T> typeLiteral)
Creates a binding to a type.


bind

<T> BindingBuilder<T> bind(Class<T> type)
Creates a binding to a type.


link

<T> LinkedBindingBuilder<T> link(Key<T> key)
Links a key to another binding.


link

<T> LinkedBindingBuilder<T> link(Class<T> type)
Links a type to another binding.


link

<T> LinkedBindingBuilder<T> link(TypeLiteral<T> type)
Links a type to another binding.


bindConstant

ConstantBindingBuilder bindConstant(Annotation annotation)
Binds a constant value to an annotation.


bindConstant

ConstantBindingBuilder bindConstant(Class<? extends Annotation> annotationType)
Binds a constant value to an annotation.


requestStaticInjection

void requestStaticInjection(Class<?>... types)
Upon successful creation, the Container will inject static fields and methods in the given classes.

Parameters:
types - for which static members will be injected

install

void install(Module module)
Uses the given module to configure more bindings.