Class RepositoryInstaller

java.lang.Object
ru.vyarus.guicey.jdbi3.installer.repository.RepositoryInstaller
All Implemented Interfaces:
ru.vyarus.dropwizard.guice.module.installer.FeatureInstaller, ru.vyarus.dropwizard.guice.module.installer.install.binding.BindingInstaller

public class RepositoryInstaller extends Object implements ru.vyarus.dropwizard.guice.module.installer.FeatureInstaller, ru.vyarus.dropwizard.guice.module.installer.install.binding.BindingInstaller
Recognize classes annotated with JdbiRepository and register them. Such classes may be then injected as usual beans and used as usual daos. All daos will participate in the thread-bound transaction, declared by transaction annotation, transaction template or manually with unit manager.

Dao may use any guice-related annotations because beans participate in guice aop. This is done by creating special guice-managed proxy class (where guice could apply aop). These proxies delegate all method calls to JDBI-managed proxies.

Manual guice bindings are not allowed, except one case: bind(Base.class).to(Repo.class) where Repo.class is a recognizable (annotated) repository. This case useful for generifying repositories (so implementation with exact queries could be pluggable).

Since:
31.08.2018
See Also:
  • Constructor Details

    • RepositoryInstaller

      public RepositoryInstaller()
  • Method Details

    • matches

      public boolean matches(Class<?> type)
      Specified by:
      matches in interface ru.vyarus.dropwizard.guice.module.installer.FeatureInstaller
    • bind

      public void bind(com.google.inject.Binder binder, Class<?> type, boolean lazy)
      Specified by:
      bind in interface ru.vyarus.dropwizard.guice.module.installer.install.binding.BindingInstaller
    • manualBinding

      public <T> void manualBinding(com.google.inject.Binder binder, Class<T> type, com.google.inject.Binding<T> binding)
      Specified by:
      manualBinding in interface ru.vyarus.dropwizard.guice.module.installer.install.binding.BindingInstaller
    • extensionBound

      public void extensionBound(com.google.inject.Stage stage, Class<?> type)
      Specified by:
      extensionBound in interface ru.vyarus.dropwizard.guice.module.installer.install.binding.BindingInstaller
    • report

      public void report()
      Specified by:
      report in interface ru.vyarus.dropwizard.guice.module.installer.FeatureInstaller
    • getRecognizableSigns

      public List<String> getRecognizableSigns()
      Specified by:
      getRecognizableSigns in interface ru.vyarus.dropwizard.guice.module.installer.FeatureInstaller