Modifier and Type | Class and Description |
---|---|
static interface |
Modules.OverriddenModuleBuilder
See the EDSL example at
override() . |
Modifier and Type | Field and Description |
---|---|
static Module |
EMPTY_MODULE |
Modifier and Type | Method and Description |
---|---|
static Module |
combine()
Deprecated.
this method call is effectively a no-op, just remove it.
|
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 Module |
combine(Module module)
Deprecated.
there's no need to "combine" one module; just install it directly.
|
static Module |
disableCircularProxiesModule()
Returns a module that will configure the injector to disable circular proxies.
|
static Modules.OverriddenModuleBuilder |
override()
Deprecated.
there's no reason to use
Modules.override() without any arguments. |
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.
|
static Module |
requireAtInjectOnConstructorsModule()
Returns a module that will configure the injector to require @
Inject on
constructors. |
static Module |
requireExactBindingAnnotationsModule()
Returns a module that will configure the injector to require an exactly matching binding
annotation.
|
static Module |
requireExplicitBindingsModule()
Returns a module that will configure the injector to require explicit bindings.
|
public static final Module EMPTY_MODULE
public static Modules.OverriddenModuleBuilder override(Module... modules)
PrivateModule
is supplied or all elements are from a single PrivateBinder
, then this will overwrite the private bindings. Otherwise, private bindings will
not be overwritten unless they are exposed. 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.
modules
- the modules whose bindings are open to be overridden@Deprecated public static Modules.OverriddenModuleBuilder override()
Modules.override()
without any arguments.public static Modules.OverriddenModuleBuilder override(Iterable<? extends Module> modules)
PrivateModule
is supplied or all elements are from a single PrivateBinder
, then this will overwrite the private bindings. Otherwise, private bindings will
not be overwritten unless they are exposed. 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.
modules
- the modules whose bindings are open to be overriddenpublic static Module combine(Module... modules)
modules
.
Although sometimes helpful, this method is rarely necessary. Most Guice APIs accept multiple
arguments or (like install()
) can be called repeatedly. Where possible, external APIs
that require a single module should similarly be adapted to permit multiple modules.
@Deprecated public static Module combine(Module module)
@Deprecated public static Module combine()
public static Module combine(Iterable<? extends Module> modules)
modules
.
Although sometimes helpful, this method is rarely necessary. Most Guice APIs accept multiple
arguments or (like install()
) can be called repeatedly. Where possible, external APIs
that require a single module should similarly be adapted to permit multiple modules.
public static Module requireExplicitBindingsModule()
public static Module requireAtInjectOnConstructorsModule()
Inject
on
constructors.Binder.requireAtInjectOnConstructors()
public static Module requireExactBindingAnnotationsModule()
Binder.requireExactBindingAnnotations()
public static Module disableCircularProxiesModule()
Copyright © 2006–2020 Google, Inc.. All rights reserved.