public abstract class GuiceyFruitModule
extends com.google.inject.AbstractModule
Constructor and Description |
---|
GuiceyFruitModule() |
Modifier and Type | Method and Description |
---|---|
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> |
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> |
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> |
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> |
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> |
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> |
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) |
addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindListener, bindScope, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding
protected void configure()
configure
in class com.google.inject.AbstractModule
protected <A extends Annotation> void bindMethodHandler(Class<A> annotationType, MethodHandler methodHandler)
protected <A extends Annotation> void bindMethodHandler(Class<A> annotationType, com.google.inject.Key<? extends MethodHandler> methodHandlerKey)
protected <A extends Annotation> void bindMethodHandler(Class<A> annotationType, Class<? extends MethodHandler> methodHandlerType)
protected <A extends Annotation> void bindAnnotationInjector(Class<A> annotationType, com.google.inject.Key<? extends AnnotationMemberProvider> annotationMemberProviderKey)
A
- the annotation type used as the injection pointannotationType
- the annotation class used to define the injection pointannotationMemberProviderKey
- the key of the annotation member provider which can be
instantiated and injected by guiceprotected <A extends Annotation> void bindAnnotationInjector(Class<A> annotationType, AnnotationMemberProvider annotationMemberProvider)
A
- the annotation type used as the injection pointannotationType
- the annotation class used to define the injection pointannotationMemberProvider
- the annotation member provider which can be instantiated and
injected by guiceprotected <A extends Annotation> void bindAnnotationInjector(Class<A> annotationType, Class<? extends AnnotationMemberProvider> annotationMemberProviderType)
A
- the annotation type used as the injection pointannotationType
- the annotation class used to define the injection pointannotationMemberProviderType
- the type of the annotation member provider which can be
instantiated and injected by guiceprotected Class<?> getParameterType(com.google.inject.TypeLiteral<?> type, Method method, int i)
protected <I> void checkInjectedValueType(Object value, Class<?> type, com.google.inject.spi.TypeEncounter<I> encounter)
protected <T> com.google.inject.binder.LinkedBindingBuilder<T> bind(Class<T> type, Class<? extends Annotation> annotationType)
bind(Key.get(MyType.class, SomeAnnotation.class))
with this bind(KMyType.class, SomeAnnotation.class)
protected <T> com.google.inject.binder.LinkedBindingBuilder<T> bind(Class<T> type, Annotation annotation)
bind(Key.get(MyType.class, someAnnotation))
with this bind(KMyType.class, someAnnotation)
protected <T> com.google.inject.binder.LinkedBindingBuilder<T> bind(Class<T> type, String namedText)
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")
protected <T> void bindInstance(String name, T instance)
bind(instance.getClass(), name).toInstance(instance);
Apache Camel