public abstract class AnnotatedModule
extends com.google.inject.PrivateModule
This module allows binding of DynamicBindingProvider
instances for a given type and
this modules binding annotation. This is useful for namespacing bindings for library consumers
that may be combined within an application and must avoid duplicate bindings. For instance this
is useful with beadledom-client so that each service/http client library can have its own
namespaced BeadledomClient and feature bindings.
Note: This module is a private module, so any bindings that should be
available to consumers must be exposed via the PrivateModule.expose(com.google.inject.Key<T>)
methods. Also, as noted on the
DynamicBindingProvider
documentation, it is rarely a good idea to expose the dynamic
binding provider itself; instead exposing a downstream binding that may use the dynamic binding
provider internally.
PrivateModule
Modifier | Constructor and Description |
---|---|
protected |
AnnotatedModule(Class<? extends Annotation> bindingAnnotation) |
Modifier and Type | Method and Description |
---|---|
protected <T> void |
bindDynamicProvider(Class<T> clazz)
Binds a
DynamicBindingProvider for the given class and this module's binding
annotation. |
protected <T> void |
bindDynamicProvider(com.google.inject.TypeLiteral<T> typeLiteral)
Binds a
DynamicBindingProvider for the given TypeLiteral and this module's
binding annotation. |
protected Class<? extends Annotation> |
getBindingAnnotation()
Returns the binding annotation associated with this module.
|
addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindListener, bindScope, configure, configure, convertToTypes, currentStage, expose, expose, expose, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding
protected AnnotatedModule(Class<? extends Annotation> bindingAnnotation)
protected Class<? extends Annotation> getBindingAnnotation()
protected <T> void bindDynamicProvider(Class<T> clazz)
DynamicBindingProvider
for the given class and this module's binding
annotation.protected <T> void bindDynamicProvider(com.google.inject.TypeLiteral<T> typeLiteral)
DynamicBindingProvider
for the given TypeLiteral
and this module's
binding annotation.Copyright © 2020 Cerner Innovation, Inc.. All rights reserved.