java.lang.Object
com.google.inject.AbstractModule
ru.vyarus.dropwizard.guice.module.context.unique.item.UniqueModule
All Implemented Interfaces:
com.google.inject.Module

public abstract class UniqueModule extends com.google.inject.AbstractModule
Base class for unique modules: only one module instance must be accepted and all others considered duplicate. Note that class only properly implements equals method so guicey deduplication mechanism could filter other instances. It is not required to use this class to grant module uniqueness - you may directly implement equals method in your module.

Classed are compared by name to properly detect classes from different class loaders.

Also, note that guice silently ignores duplicate bindings and so in most cases it would be able to handle duplicate modules properly. This class may be used for cases when bindings registered by module instances are not equal (e.g. register something by instance or produce other side effects).

If module requires access to dropwizard specific project (via DropwizardAwareModule) then use UniqueDropwizardAwareModule instead.

Since:
13.07.2019
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
     

    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, install, requestInjection, requestInjection, requestStaticInjection, requireBinding, requireBinding

    Methods inherited from class java.lang.Object

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

    • UniqueModule

      public UniqueModule()
  • Method Details