org.apache.camel.guice.support
Class GuiceyFruitModule

java.lang.Object
  extended by com.google.inject.AbstractModule
      extended by org.apache.camel.guice.support.GuiceyFruitModule
All Implemented Interfaces:
com.google.inject.Module
Direct Known Subclasses:
Jsr250Module

public abstract class GuiceyFruitModule
extends com.google.inject.AbstractModule

Adds some new helper methods to the base Guice module

Version:

Constructor Summary
GuiceyFruitModule()
           
 
Method Summary
protected
<T> com.google.inject.binder.LinkedBindingBuilder<T>
bind(Class<T> type, Annotation annotation)
          A helper method to bind the given type with the binding annotation.
protected
<T> com.google.inject.binder.LinkedBindingBuilder<T>
bind(Class<T> type, Class<? extends Annotation> annotationType)
          A helper method to bind the given type with the binding annotation.
protected
<T> com.google.inject.binder.LinkedBindingBuilder<T>
bind(Class<T> type, String namedText)
          A helper method to bind the given type with the Named annotation of the given text value.
protected
<A extends Annotation>
void
bindAnnotationInjector(Class<A> annotationType, AnnotationMemberProvider annotationMemberProvider)
          Binds a custom injection point for a given injection annotation to the annotation member provider so that occurrences of the annotation on fields and methods with a single parameter will be injected by Guice after the constructor and @Inject have been processed.
protected
<A extends Annotation>
void
bindAnnotationInjector(Class<A> annotationType, Class<? extends AnnotationMemberProvider> annotationMemberProviderType)
          Binds a custom injection point for a given injection annotation to the annotation member provider so that occurrences of the annotation on fields and methods with a single parameter will be injected by Guice after the constructor and @Inject have been processed.
protected
<A extends Annotation>
void
bindAnnotationInjector(Class<A> annotationType, com.google.inject.Key<? extends AnnotationMemberProvider> annotationMemberProviderKey)
          Binds a custom injection point for a given injection annotation to the annotation member provider so that occurrences of the annotation on fields and methods with a single parameter will be injected by Guice after the constructor and @Inject have been processed.
protected
<T> void
bindInstance(String name, T instance)
          A helper method which binds a named instance to a key defined by the given name and the instances type.
protected
<A extends Annotation>
void
bindMethodHandler(Class<A> annotationType, Class<? extends MethodHandler> methodHandlerType)
          Binds a post injection hook method annotated with the given annotation to the given method handler.
protected
<A extends Annotation>
void
bindMethodHandler(Class<A> annotationType, com.google.inject.Key<? extends MethodHandler> methodHandlerKey)
          Binds a post injection hook method annotated with the given annotation to the given method handler.
protected
<A extends Annotation>
void
bindMethodHandler(Class<A> annotationType, MethodHandler methodHandler)
          Binds a post injection hook method annotated with the given annotation to the given method handler.
protected
<I> void
checkInjectedValueType(Object value, Class<?> type, com.google.inject.spi.TypeEncounter<I> encounter)
          Returns true if the value to be injected is of the correct type otherwise an error is raised on the encounter and false is returned
protected  void configure()
           
protected  Class<?> getParameterType(com.google.inject.TypeLiteral<?> type, Method method, int i)
           
 
Methods inherited from class com.google.inject.AbstractModule
addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindScope, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GuiceyFruitModule

public GuiceyFruitModule()
Method Detail

configure

protected void configure()
Specified by:
configure in class com.google.inject.AbstractModule

bindMethodHandler

protected <A extends Annotation> void bindMethodHandler(Class<A> annotationType,
                                                        MethodHandler methodHandler)
Binds a post injection hook method annotated with the given annotation to the given method handler.


bindMethodHandler

protected <A extends Annotation> void bindMethodHandler(Class<A> annotationType,
                                                        com.google.inject.Key<? extends MethodHandler> methodHandlerKey)
Binds a post injection hook method annotated with the given annotation to the given method handler.


bindMethodHandler

protected <A extends Annotation> void bindMethodHandler(Class<A> annotationType,
                                                        Class<? extends MethodHandler> methodHandlerType)
Binds a post injection hook method annotated with the given annotation to the given method handler.


bindAnnotationInjector

protected <A extends Annotation> void bindAnnotationInjector(Class<A> annotationType,
                                                             com.google.inject.Key<? extends AnnotationMemberProvider> annotationMemberProviderKey)
Binds a custom injection point for a given injection annotation to the annotation member provider so that occurrences of the annotation on fields and methods with a single parameter will be injected by Guice after the constructor and @Inject have been processed.

Type Parameters:
A - the annotation type used as the injection point
Parameters:
annotationType - the annotation class used to define the injection point
annotationMemberProviderKey - the key of the annotation member provider which can be instantiated and injected by guice

bindAnnotationInjector

protected <A extends Annotation> void bindAnnotationInjector(Class<A> annotationType,
                                                             AnnotationMemberProvider annotationMemberProvider)
Binds a custom injection point for a given injection annotation to the annotation member provider so that occurrences of the annotation on fields and methods with a single parameter will be injected by Guice after the constructor and @Inject have been processed.

Type Parameters:
A - the annotation type used as the injection point
Parameters:
annotationType - the annotation class used to define the injection point
annotationMemberProvider - the annotation member provider which can be instantiated and injected by guice

bindAnnotationInjector

protected <A extends Annotation> void bindAnnotationInjector(Class<A> annotationType,
                                                             Class<? extends AnnotationMemberProvider> annotationMemberProviderType)
Binds a custom injection point for a given injection annotation to the annotation member provider so that occurrences of the annotation on fields and methods with a single parameter will be injected by Guice after the constructor and @Inject have been processed.

Type Parameters:
A - the annotation type used as the injection point
Parameters:
annotationType - the annotation class used to define the injection point
annotationMemberProviderType - the type of the annotation member provider which can be instantiated and injected by guice

getParameterType

protected Class<?> getParameterType(com.google.inject.TypeLiteral<?> type,
                                    Method method,
                                    int i)

checkInjectedValueType

protected <I> void checkInjectedValueType(Object value,
                                          Class<?> type,
                                          com.google.inject.spi.TypeEncounter<I> encounter)
Returns true if the value to be injected is of the correct type otherwise an error is raised on the encounter and false is returned


bind

protected <T> com.google.inject.binder.LinkedBindingBuilder<T> bind(Class<T> type,
                                                                    Class<? extends Annotation> annotationType)
A helper method to bind the given type with the binding annotation. This allows you to replace this code bind(Key.get(MyType.class, SomeAnnotation.class)) with this bind(KMyType.class, SomeAnnotation.class)


bind

protected <T> com.google.inject.binder.LinkedBindingBuilder<T> bind(Class<T> type,
                                                                    Annotation annotation)
A helper method to bind the given type with the binding annotation. This allows you to replace this code bind(Key.get(MyType.class, someAnnotation)) with this bind(KMyType.class, someAnnotation)


bind

protected <T> com.google.inject.binder.LinkedBindingBuilder<T> bind(Class<T> type,
                                                                    String namedText)
A helper method to bind the given type with the Named annotation of the given text value. This allows you to replace this code bind(Key.get(MyType.class, Names.named("myName"))) with this bind(KMyType.class, "myName")


bindInstance

protected <T> void bindInstance(String name,
                                T instance)
A helper method which binds a named instance to a key defined by the given name and the instances type. So this method is short hand for bind(instance.getClass(), name).toInstance(instance);



Apache Camel