Class GuiceModule

java.lang.Object
com.google.inject.AbstractModule
com.peterphi.std.guice.common.GuiceModule
All Implemented Interfaces:
com.google.inject.Module

public abstract class GuiceModule extends com.google.inject.AbstractModule
Helper class for modules
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected GuiceConfig
    A reference to the Guice Config environment that is automatically set before AbstractModule.configure() is called
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected <T> JAXBResourceProvider<T>
    bindConfigFile(Class<T> type, String propertyName)
    Adds a new binding for the given JAXB type to a config source propertyName.
    protected void
    install(com.google.inject.Module module)
     
    void
     

    Methods inherited from class com.google.inject.AbstractModule

    addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindListener, bindScope, configure, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, requestInjection, requestStaticInjection, requireBinding, requireBinding

    Methods inherited from class java.lang.Object

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

    • config

      protected GuiceConfig config
      A reference to the Guice Config environment that is automatically set before AbstractModule.configure() is called
  • Constructor Details

    • GuiceModule

      public GuiceModule()
  • Method Details

    • setConfig

      public void setConfig(GuiceConfig config)
    • bindConfigFile

      protected <T> JAXBResourceProvider<T> bindConfigFile(Class<T> type, String propertyName)
      Adds a new binding for the given JAXB type to a config source propertyName. This binding registers a JAXBResourceProvider that can auto-reload if the underlying file changes
      Type Parameters:
      T - type of the config file
      Parameters:
      type - the config type
      propertyName - the GuiceConfig property to read from for the config
    • install

      protected void install(com.google.inject.Module module)
      Overrides:
      install in class com.google.inject.AbstractModule