Class UniqueModule
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.
-
Constructor Summary
Constructors -
Method Summary
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