public interface DynamicBindingProvider<T>
This class allows providers and modules to be assigned a binding annotation at runtime, rather than compile time, and then use that binding annotation to retrieve bindings for that annotation.
Warning: It is rarely a good idea to expose instances of this provider
globally. Ideally these should be used within a PrivateModule
or AnnotatedModule
and kept within the scope of those modules. There is still benefit from using a dynamic binding
provider in this way and then exposing downstream types that can be built from the dynamic
binding provider.
Modifier and Type | Method and Description |
---|---|
T |
get(Class<? extends Annotation> bindingAnnotation)
Returns an instance of
T bound to the specified annotation. |
T get(Class<? extends Annotation> bindingAnnotation)
T
bound to the specified annotation.RuntimeException
- if the injector encounters an error while providing an instance or
an instance is not bound.Copyright © 2018 Cerner Innovation, Inc.. All rights reserved.