public interface BindingInstaller
FeatureInstaller.
Used for installers which requires custom bindings for extension.
Note: binder.bind(type) is not called by default for binding installer, assuming installer will
specify proper binding itself.
bindExtension(Binder, Class, boolean) called for extensions not manually bound in guicecheckBinding(Binder, Class, Binding) called for extensions, resolved from manual guice bindinginstallBinding(Binder, Class) is always called after one of install methods above in order to
apply registrations common for both registration types. Ideal for reporting.Install methods may be also used to restrict extension declaration only as class or bindings.
If extension is annotated with LazyBinding boolean hint is passed and installer must decide
what to do with it (preferably support or fail, not ignore). Bindings extensions (resolved from guice modules)
may not be declared as lazy (this will be detected automatically).
Installer may be called multiple times if guice bindings or aop report is enabled. If required, report execution
may be detected by used stage: binder.currentStage() == Stage.TOOL.
PluginInstaller| Modifier and Type | Method and Description |
|---|---|
void |
bindExtension(com.google.inject.Binder binder,
java.lang.Class<?> type,
boolean lazy)
Called to apply custom binding for installed feature.
|
<T> void |
checkBinding(com.google.inject.Binder binder,
java.lang.Class<T> type,
com.google.inject.Binding<T> manualBinding)
Called for extensions, resolved from guice bindings (in user modules).
|
void |
installBinding(com.google.inject.Binder binder,
java.lang.Class<?> type)
Called after execution of one of above methods.
|
void bindExtension(com.google.inject.Binder binder,
java.lang.Class<?> type,
boolean lazy)
binder.bind(type). This method will be called
instead of default registration.
Called only for non binding extensions (extensions that are not already bound in guice module.
WARNING: may be called multiple times due to enabled bindings reporting! Be sure to produce correct logs.
binder - guice bindertype - extension classlazy - true if extension is annotated with LazyBinding<T> void checkBinding(com.google.inject.Binder binder,
java.lang.Class<T> type,
com.google.inject.Binding<T> manualBinding)
LazyBinding flag is not used here because guicey will automatically throw an error if existing binding
is annotated as lazy binding (which don't makes any sense).
WARNING: may be called multiple times due to enabled bindings reporting! Be sure to produce correct logs.
T - extension type, used to connect extension class with bindingbinder - guice bindertype - extension classmanualBinding - binding declaration from guice modulefor errors reportingvoid installBinding(com.google.inject.Binder binder,
java.lang.Class<?> type)
WARNING: may be called multiple times due to enabled bindings reporting! Be sure to produce correct logs.
binder - guice bindertype - extension class