public interface GroovyBindingsSpec extends BindingsSpec
BindingsSpec.| Modifier and Type | Method and Description |
|---|---|
GroovyBindingsSpec |
add(Iterable<? extends Module> modules)
Adds the bindings from the given modules.
|
GroovyBindingsSpec |
add(Module... modules)
Adds the bindings from the given modules.
|
GroovyBindingsSpec |
bind(Class<?> type)
Add a binding for the given type.
|
<T> GroovyBindingsSpec |
bind(Class<T> publicType,
Class<? extends T> implType)
Add a binding for the given public type, to the given implementation type.
|
GroovyBindingsSpec |
binder(Action<? super Binder> action)
Adds bindings by directly configuring a
Binder. |
<T> GroovyBindingsSpec |
bindInstance(Class<? super T> publicType,
T instance)
Add a binding for the given public type, to the given implementing instance.
|
<T> GroovyBindingsSpec |
bindInstance(T instance)
Add a binding for the given object to its concrete type.
|
<T extends Module> |
config(Class<T> moduleClass,
Consumer<? super T> configurer)
Retrieves the module that has been added with the given type for configuration.
|
GroovyBindingsSpec |
init(Action<? super Injector> action)
Registers an action to operate on the injector when it has been finalized.
|
GroovyBindingsSpec |
init(Class<? extends Runnable> clazz)
Registers a runnable to instantiated via dependency injection when the injector is created from this module registry.
|
GroovyBindingsSpec |
init(Closure<?> closure)
Adds a closure based application initializer.
|
<T> GroovyBindingsSpec |
provider(Class<T> publicType,
Provider<? extends T> provider)
Add a binding for the given public type, to the given provider.
|
<T> GroovyBindingsSpec |
providerType(Class<T> publicType,
Class<? extends Provider<? extends T>> providerType)
Add a binding for the given public type, to the given provider type.
|
getLaunchConfigGroovyBindingsSpec init(@DelegatesTo(value=java.lang.Void.class,strategy=2) Closure<?> closure)
The closure can declare parameters, that will be injected. That is, parameters must be typed and implementations of such types must be provided by the modules.
closure - The initializerGroovyBindingsSpec add(Module... modules)
add in interface BindingsSpecmodules - modules whose bindings should be addedGroovyBindingsSpec add(Iterable<? extends Module> modules)
add in interface BindingsSpecmodules - modules whose bindings should be added<T extends Module> GroovyBindingsSpec config(Class<T> moduleClass, Consumer<? super T> configurer) throws NoSuchModuleException
This can be used to configure modules that have already been added by some other mechanism.
config in interface BindingsSpecT - the type of the module to retrievemoduleClass - the type of the module to retrieveconfigurer - the configurer of the moduleNoSuchModuleException - if no module has been added with the given typeGroovyBindingsSpec binder(Action<? super Binder> action)
Binder.binder in interface BindingsSpecaction - the binder configurationGroovyBindingsSpec bind(Class<?> type)
bind in interface BindingsSpectype - the type to add a binding for<T> GroovyBindingsSpec bind(Class<T> publicType, Class<? extends T> implType)
bind in interface BindingsSpecT - the public type of the bindingpublicType - the public type of the bindingimplType - the class implementing the public type<T> GroovyBindingsSpec bindInstance(Class<? super T> publicType, T instance)
bindInstance in interface BindingsSpecT - the public type of the bindingpublicType - the public type of the bindinginstance - the instance that implements the public type<T> GroovyBindingsSpec bindInstance(T instance)
bindInstance in interface BindingsSpecT - the type of the bindinginstance - the instance to bind<T> GroovyBindingsSpec providerType(Class<T> publicType, Class<? extends Provider<? extends T>> providerType)
providerType in interface BindingsSpecT - The public type of the objectpublicType - the public type of the objectproviderType - the type of the provider for the object<T> GroovyBindingsSpec provider(Class<T> publicType, Provider<? extends T> provider)
provider in interface BindingsSpecT - The public type of the objectpublicType - the public type of the objectprovider - the provider for the objectGroovyBindingsSpec init(Action<? super Injector> action)
This can be used to do post processing of registered objects or application initialisation.
init in interface BindingsSpecaction - GroovyBindingsSpec init(Class<? extends Runnable> clazz)
This facilitates writing a Runnable implementation that uses constructor injection to get hold of what it needs to for the initialization.
init in interface BindingsSpecclazz - the class of the runnable to execute as an init action