Class LifeCycleInstaller

java.lang.Object
ru.vyarus.dropwizard.guice.module.installer.feature.LifeCycleInstaller
All Implemented Interfaces:
FeatureInstaller, InstanceInstaller<org.eclipse.jetty.util.component.LifeCycle>, Ordered

public class LifeCycleInstaller extends Object implements FeatureInstaller, InstanceInstaller<org.eclipse.jetty.util.component.LifeCycle>, Ordered
Lifecycle objects installer. Looks for classes implementing org.eclipse.jetty.util.component.LifeCycle and register them in environment.
Since:
01.09.2014
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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, org.eclipse.jetty.util.component.LifeCycle instance)
    Use FeatureUtils.getInstanceClass(instance) to overcome proxies and get correct type.
    boolean
    matches(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
    Called to log registered endpoints in dropwizard log fashion.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LifeCycleInstaller

      public LifeCycleInstaller()
  • Method Details

    • matches

      public boolean matches(Class<?> type)
      Description copied from interface: FeatureInstaller
      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).

      When type accepted by any extension it's registered in guice module.

      Specified by:
      matches in interface FeatureInstaller
      Parameters:
      type - type to check
      Returns:
      true if extension recognized, false otherwise
    • install

      public void install(io.dropwizard.core.setup.Environment environment, org.eclipse.jetty.util.component.LifeCycle instance)
      Description copied from interface: InstanceInstaller
      Use FeatureUtils.getInstanceClass(instance) to overcome proxies and get correct type.

      Full Injector could be obtained with InjectorLookup.getInjector(Environment).

      Shared state could be obtained with SharedConfigurationState.get(Environment)

      Specified by:
      install in interface InstanceInstaller<org.eclipse.jetty.util.component.LifeCycle>
      Parameters:
      environment - environment object
      instance - 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. Use Reporter to simplify reporting.

      Method may do nothing if reporting not required

      Specified by:
      report in interface FeatureInstaller
    • getRecognizableSigns

      public List<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 interface FeatureInstaller
      Returns:
      list of extension signs installer recognize