Class TaskInstaller
- java.lang.Object
-
- ru.vyarus.dropwizard.guice.module.installer.feature.TaskInstaller
-
- All Implemented Interfaces:
FeatureInstaller
,InstanceInstaller<io.dropwizard.servlets.tasks.Task>
public class TaskInstaller extends java.lang.Object implements FeatureInstaller, InstanceInstaller<io.dropwizard.servlets.tasks.Task>
Dropwizard tasks installer. Looks for classes extendingio.dropwizard.servlets.tasks.Task
and register in environment.- Since:
- 01.09.2014
-
-
Constructor Summary
Constructors Constructor Description TaskInstaller()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.String>
getRecognizableSigns()
Method used by extensions help report (GuiceBundle.Builder.printExtensionsHelp()
) to show what signs this exact installer recognize so user could better understand extensions support specifics.void
install(io.dropwizard.core.setup.Environment environment, io.dropwizard.servlets.tasks.Task instance)
UseFeatureUtils.getInstanceClass(instance)
to overcome proxies and get correct type.boolean
matches(java.lang.Class<?> type)
NOTE: consider usingru.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.
-
-
-
Method Detail
-
matches
public boolean matches(java.lang.Class<?> type)
Description copied from interface:FeatureInstaller
NOTE: consider usingru.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.
- Specified by:
matches
in interfaceFeatureInstaller
- Parameters:
type
- type to check- Returns:
- true if extension recognized, false otherwise
-
install
public void install(io.dropwizard.core.setup.Environment environment, io.dropwizard.servlets.tasks.Task instance)
Description copied from interface:InstanceInstaller
UseFeatureUtils.getInstanceClass(instance)
to overcome proxies and get correct type.Full
Injector
could be obtained withInjectorLookup.getInjector(Environment)
.Shared state could be obtained with
SharedConfigurationState.get(Environment)
- Specified by:
install
in interfaceInstanceInstaller<io.dropwizard.servlets.tasks.Task>
- Parameters:
environment
- environment objectinstance
- extension instance
-
report
public void report()
Description copied from interface:FeatureInstaller
Called to log registered endpoints in dropwizard log fashion. It's important to naturally show all dynamically resolved classes to easily catch errors. UseReporter
to simplify reporting.Method may do nothing if reporting not required
- Specified by:
report
in interfaceFeatureInstaller
-
getRecognizableSigns
public java.util.List<java.lang.String> getRecognizableSigns()
Description copied from interface:FeatureInstaller
Method used by extensions help report (GuiceBundle.Builder.printExtensionsHelp()
) to show what signs this exact installer recognize so user could better understand extensions support specifics.- Specified by:
getRecognizableSigns
in interfaceFeatureInstaller
- Returns:
- list of extension signs installer recognize
-
-