org.elasticsearch.common.inject.util
Class Modules

java.lang.Object
  extended by org.elasticsearch.common.inject.util.Modules

public final class Modules
extends Object

Static utility methods for creating and working with instances of Module.

Since:
2.0
Author:
jessewilson@google.com (Jesse Wilson)

Nested Class Summary
static interface Modules.OverriddenModuleBuilder
          See the EDSL example at override().
 
Field Summary
static Module EMPTY_MODULE
           
 
Method Summary
static Module combine(Iterable<? extends Module> modules)
          Returns a new module that installs all of modules.
static Module combine(Module... modules)
          Returns a new module that installs all of modules.
static Modules.OverriddenModuleBuilder override(Iterable<? extends Module> modules)
          Returns a builder that creates a module that overlays override modules over the given modules.
static Modules.OverriddenModuleBuilder override(Module... modules)
          Returns a builder that creates a module that overlays override modules over the given modules.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_MODULE

public static final Module EMPTY_MODULE
Method Detail

override

public static Modules.OverriddenModuleBuilder override(Module... modules)
Returns a builder that creates a module that overlays override modules over the given modules. If a key is bound in both sets of modules, only the binding from the override modules is kept. This can be used to replace the bindings of a production module with test bindings:
 Module functionalTestModule
     = Modules.override(new ProductionModule()).with(new TestModule());
 

Prefer to write smaller modules that can be reused and tested without overrides.

Parameters:
modules - the modules whose bindings are open to be overridden

override

public static Modules.OverriddenModuleBuilder override(Iterable<? extends Module> modules)
Returns a builder that creates a module that overlays override modules over the given modules. If a key is bound in both sets of modules, only the binding from the override modules is kept. This can be used to replace the bindings of a production module with test bindings:
 Module functionalTestModule
     = Modules.override(getProductionModules()).with(getTestModules());
 

Prefer to write smaller modules that can be reused and tested without overrides.

Parameters:
modules - the modules whose bindings are open to be overridden

combine

public static Module combine(Module... modules)
Returns a new module that installs all of modules.


combine

public static Module combine(Iterable<? extends Module> modules)
Returns a new module that installs all of modules.



Copyright © 2009-2012. All Rights Reserved.