public class ResourceInstaller extends java.lang.Object implements FeatureInstaller<java.lang.Object>, BindingInstaller, TypeInstaller<java.lang.Object>, JerseyInstaller<java.lang.Object>
Path. Directly register instance in jersey context to force singleton.
If we register it by type, then we could use prototype beans (resource instance created on each request),
which will lead to performance overhead. To ovoid misuse, singleton resources are forced. Override installer
if you really need prototype resources.| Constructor and Description |
|---|
ResourceInstaller() |
| Modifier and Type | Method and Description |
|---|---|
void |
install(org.glassfish.hk2.utilities.binding.AbstractBinder binder,
com.google.inject.Injector injector,
java.lang.Class<java.lang.Object> type)
Called on jersey start to inject extensions into HK context.
|
<T> void |
install(com.google.inject.Binder binder,
java.lang.Class<? extends T> type,
boolean lazy)
Called to apply custom binding for installed feature.
|
void |
install(io.dropwizard.setup.Environment environment,
java.lang.Class<java.lang.Object> type) |
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 install(io.dropwizard.setup.Environment environment,
java.lang.Class<java.lang.Object> type)
install in interface TypeInstaller<java.lang.Object>environment - environment objecttype - extension typepublic void install(org.glassfish.hk2.utilities.binding.AbstractBinder binder,
com.google.inject.Injector injector,
java.lang.Class<java.lang.Object> type)
JerseyInstallerJerseyBinding utility for proper types binding:
it provide utilities for various jersey extensions and use special "bridges" for registration to
respect guice scopes (most of the time we not register ready instance, but factory which delegates
creation to guice).install in interface JerseyInstaller<java.lang.Object>binder - hk binderinjector - guice injectortype - extension type to registerJerseyBinding,
HK2Managedpublic void report()
FeatureInstallerReporter to simplify reporting.
Method may do nothing if reporting not required
report in interface FeatureInstaller<java.lang.Object>