Package io.activej.inject.module
Interface ModuleBuilder
- All Known Subinterfaces:
ModuleBuilder0<T>,ModuleBuilder1<T>
- All Known Implementing Classes:
ModuleBuilderImpl
public interface ModuleBuilder
This interface is used to restrict the DSL.
Basically, it disallows any methods from
ModuleBuilder0 not listed below
to be called without previously calling bind(...).-
Method Summary
Modifier and TypeMethodDescription<T> ModuleBuilder0<T>This method begins a chain of binding builder DSL calls.default <T> ModuleBuilder0<T>Begins a chain of binding builder DSL callsdefault <T> ModuleBuilder0<T>Begins a chain of binding builder DSL callsdefault <T> ModuleBuilderbindInstanceInjector(Key<T> key) default <T> ModuleBuilderbindInstanceInjector(Class<T> type) default <T> ModuleBuilderbindInstanceProvider(Key<T> key) default <T> ModuleBuilderbindInstanceProvider(Class<T> type) <S,T extends S>
ModuleBuilderbindIntoSet(Key<S> setOf, Binding<T> binding) This is a helper method that provides a functionality similar toProvidesIntoSet.default <S,T extends S>
ModuleBuilderbindIntoSet(Key<S> setOf, Key<T> item) A helper method that provides a functionality similar toProvidesIntoSet.default <T> ModuleBuilderbindOptionalDependency(Key<T> key) default <T> ModuleBuilderbindOptionalDependency(Class<T> type) build()static ModuleBuildercreate()<T> ModuleBuildergenerate(KeyPattern<T> pattern, BindingGenerator<T> bindingGenerator) Adds ageneratorfor a given class to this module.default <T> ModuleBuildergenerate(Class<T> pattern, BindingGenerator<T> bindingGenerator) Adds ageneratorfor a given class to this module.default ModuleBuilderAdds all bindings, transformers, generators and multibinders from given modules to this one.install(Collection<Module> modules) Adds all bindings, transformers, generators and multibinders from given modules to this one.<T> ModuleBuildermultibind(Key<T> key, Multibinder<T> multibinder) Adds amultibinderfor a given key to this module.default <K,V> ModuleBuilder multibindToMap(Class<K> keyType, Class<V> valueType) default <K,V> ModuleBuilder multibindToMap(Class<K> keyType, Class<V> valueType, Object qualifier) default <V> ModuleBuildermultibindToSet(Key<V> key) default <V> ModuleBuildermultibindToSet(Class<V> type) default <V> ModuleBuildermultibindToSet(Class<V> type, Object qualifier) default ModuleBuilderSame asscan(java.lang.Class<?>, java.lang.Object), but scans only static methods and does not depend on instance of the class.Scans class hierarchy and then installs providers from each class as modules, so that exports do not interfere between classes.default ModuleBuilderSame asscan(java.lang.Class<?>, java.lang.Object), with staring class defaulting to the class of the object instance.<T> ModuleBuildertransform(KeyPattern<T> pattern, BindingTransformer<T> bindingTransformer) Adds atransformerwith a given type to this module.default <T> ModuleBuildertransform(Class<T> pattern, BindingTransformer<T> bindingTransformer) Adds atransformerwith a given class to this module.
-
Method Details
-
create
-
install
Adds all bindings, transformers, generators and multibinders from given modules to this one.This works just as if you'd define all of those directly in this module.
-
install
Adds all bindings, transformers, generators and multibinders from given modules to this one.This works just as if you'd define all of those directly in this module.
- See Also:
-
scan
Scans class hierarchy and then installs providers from each class as modules, so that exports do not interfere between classes. Class parameter is used to specify from which class in the hierarchy to start. -
scan
Same asscan(java.lang.Class<?>, java.lang.Object), with staring class defaulting to the class of the object instance. -
scan
Same asscan(java.lang.Class<?>, java.lang.Object), but scans only static methods and does not depend on instance of the class. Non-static annotated methods areprohibited. -
bind
Begins a chain of binding builder DSL calls- See Also:
-
bind
Begins a chain of binding builder DSL calls- See Also:
-
bind
This method begins a chain of binding builder DSL calls.You can use generics in it, only those that are defined at the module class. And you need to subclass the module at the usage point to 'bake' those generics into subclass bytecode so that they could be fetched by this bind call.
-
bindInstanceProvider
-
bindInstanceProvider
-
bindInstanceInjector
-
bindInstanceInjector
-
bindOptionalDependency
-
bindOptionalDependency
-
bindIntoSet
This is a helper method that provides a functionality similar toProvidesIntoSet. It binds given binding as a singleton set to a set key made from given key and alsomultibindseach of such sets together. -
bindIntoSet
A helper method that provides a functionality similar toProvidesIntoSet.- See Also:
-
generate
Adds ageneratorfor a given class to this module. -
generate
Adds ageneratorfor a given class to this module. -
transform
Adds atransformerwith a given type to this module. -
transform
Adds atransformerwith a given class to this module. -
multibind
Adds amultibinderfor a given key to this module. -
multibindToSet
-
multibindToSet
-
multibindToSet
-
multibindToMap
-
multibindToMap
-
build
Module build()
-