public class EagerSingletonInstaller extends java.lang.Object implements FeatureInstaller<java.lang.Object>, BindingInstaller
@EagerSingleton annotation and register them in guice context.
This may be useful for outstanding classes (not injected by other beans and so not registered with guice.
Normally such classes must be manually registered, but using @EagerSingleton annotation allows
to register them automatically.
Moreover, even in DEVELOPMENT stage instance will be requested, which makes class suitable
for initialization logic.| Constructor and Description |
|---|
EagerSingletonInstaller() |
| Modifier and Type | Method and Description |
|---|---|
<T> void |
install(com.google.inject.Binder binder,
java.lang.Class<? extends T> type,
boolean lazy)
Called to apply custom binding for installed feature.
|
boolean |
matches(java.lang.Class<?> type)
NOTE: consider using
ru.vyarus.dropwizard.guice.module.installer.util.FeatureUtils to simplify checks
(for example, types most likely must be checks to be not abstract). |
void |
report()
Called to log registered endpoints in dropwizard log fashion.
|
public boolean matches(java.lang.Class<?> type)
FeatureInstallerru.vyarus.dropwizard.guice.module.installer.util.FeatureUtils to simplify checks
(for example, types most likely must be checks to be not abstract).
When type accepted by any extension it's registered in guice module.
matches in interface FeatureInstaller<java.lang.Object>type - type to checkpublic <T> void install(com.google.inject.Binder binder,
java.lang.Class<? extends T> type,
boolean lazy)
BindingInstallerbinder.install(type) by default, so
implement it only if some custom binding required.install in interface BindingInstallerT - plugin type (used just to define strict hierarchy and simplify binding)binder - guice bindertype - extension classlazy - true if extension is annotated with @LazyBindingpublic void report()
FeatureInstallerReporter to simplify reporting.
Method may do nothing if reporting not required
report in interface FeatureInstaller<java.lang.Object>