Package play.inject.guice
Class GuiceBuilder<Self,Delegate extends play.api.inject.guice.GuiceBuilder<Delegate>>
- Object
-
- play.inject.guice.GuiceBuilder<Self,Delegate>
-
- Type Parameters:
Self
- the concrete type that is extending this classDelegate
- a scala GuiceBuilder type.
- Direct Known Subclasses:
GuiceApplicationBuilder
,GuiceInjectorBuilder
public abstract class GuiceBuilder<Self,Delegate extends play.api.inject.guice.GuiceBuilder<Delegate>> extends Object
A builder for creating Guice-backed Play Injectors.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
GuiceBuilder(Delegate delegate)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description com.google.inject.Module
applicationModule()
Create a Guice module that can be used to inject an Application.Self
bindings(com.google.inject.Module... modules)
Add bindings from Guice modules.Self
bindings(play.api.inject.Binding<?>... bindings)
Add Play bindings.Self
bindings(play.api.inject.guice.GuiceableModule... modules)
Add bindings from guiceable modules.Self
bindings(play.api.inject.Module... modules)
Add bindings from Play modules.Self
configure(com.typesafe.config.Config conf)
Add additional configuration.Self
configure(String key, Object value)
Add additional configuration.Self
configure(Map<String,Object> conf)
Add additional configuration.Self
disable(Class<?>... moduleClasses)
Disable modules by class.Self
in(File path)
Set the environment path.Self
in(ClassLoader classLoader)
Set the environment class loader.Self
in(Environment env)
Set the environment.Self
in(Mode mode)
Set the environment mode.Injector
injector()
Create a Play Injector backed by Guice using this configured builder.protected abstract Self
newBuilder(Delegate delegate)
Self
overrides(com.google.inject.Module... modules)
Override bindings using Guice modules.Self
overrides(play.api.inject.Binding<?>... bindings)
Override bindings using Play bindings.Self
overrides(play.api.inject.guice.GuiceableModule... modules)
Override bindings using guiceable modules.Self
overrides(play.api.inject.Module... modules)
Override bindings using Play modules.
-
-
-
Constructor Detail
-
GuiceBuilder
protected GuiceBuilder(Delegate delegate)
-
-
Method Detail
-
in
public final Self in(Environment env)
Set the environment.- Parameters:
env
- the environment to configure into this application- Returns:
- a copy of this builder with the new environment
-
in
public final Self in(File path)
Set the environment path.- Parameters:
path
- the path to configure- Returns:
- a copy of this builder with the new path
-
in
public final Self in(Mode mode)
Set the environment mode.- Parameters:
mode
- the mode to configure- Returns:
- a copy of this build configured with this mode
-
in
public final Self in(ClassLoader classLoader)
Set the environment class loader.- Parameters:
classLoader
- the class loader to use- Returns:
- a copy of this builder configured with the class loader
-
configure
public final Self configure(com.typesafe.config.Config conf)
Add additional configuration.- Parameters:
conf
- the configuration to add- Returns:
- a copy of this builder configured with the supplied configuration
-
configure
public final Self configure(Map<String,Object> conf)
Add additional configuration.- Parameters:
conf
- the configuration to add- Returns:
- a copy of this builder configured with the supplied configuration
-
configure
public final Self configure(String key, Object value)
Add additional configuration.- Parameters:
key
- a configuration key to setvalue
- the associated value forkey
- Returns:
- a copy of this builder configured with the key=value
-
bindings
public final Self bindings(play.api.inject.guice.GuiceableModule... modules)
Add bindings from guiceable modules.- Parameters:
modules
- the set of modules to bind- Returns:
- a copy of this builder configured with those modules
-
bindings
public final Self bindings(com.google.inject.Module... modules)
Add bindings from Guice modules.- Parameters:
modules
- the set of Guice modules whose bindings to apply- Returns:
- a copy of this builder configured with the provided bindings
-
bindings
public final Self bindings(play.api.inject.Module... modules)
Add bindings from Play modules.- Parameters:
modules
- the set of Guice modules whose bindings to apply- Returns:
- a copy of this builder configured with the provided bindings
-
bindings
public final Self bindings(play.api.inject.Binding<?>... bindings)
Add Play bindings.- Parameters:
bindings
- the set of play bindings to apply- Returns:
- a copy of this builder configured with the provided bindings
-
overrides
public final Self overrides(play.api.inject.guice.GuiceableModule... modules)
Override bindings using guiceable modules.- Parameters:
modules
- the set of Guice modules whose bindings override some previously configured ones- Returns:
- a copy of this builder re-configured with the provided bindings
-
overrides
public final Self overrides(com.google.inject.Module... modules)
Override bindings using Guice modules.- Parameters:
modules
- the set of Guice modules whose bindings override some previously configured ones- Returns:
- a copy of this builder re-configured with the provided bindings
-
overrides
public final Self overrides(play.api.inject.Module... modules)
Override bindings using Play modules.- Parameters:
modules
- the set of Play modules whose bindings override some previously configured ones- Returns:
- a copy of this builder re-configured with the provided bindings
-
overrides
public final Self overrides(play.api.inject.Binding<?>... bindings)
Override bindings using Play bindings.- Parameters:
bindings
- a set of Play bindings that override some previously configured ones- Returns:
- a copy of this builder re-configured with the provided bindings
-
disable
public final Self disable(Class<?>... moduleClasses)
Disable modules by class.- Parameters:
moduleClasses
- the module classes whose bindings should be disabled- Returns:
- a copy of this builder configured to ignore the provided module classes
-
applicationModule
public com.google.inject.Module applicationModule()
Create a Guice module that can be used to inject an Application.- Returns:
- the module
-
injector
public Injector injector()
Create a Play Injector backed by Guice using this configured builder.- Returns:
- the injector
-
-