Package io.smallrye.beanbag
Class BeanBag.SupplierBuilder<T>
java.lang.Object
io.smallrye.beanbag.BeanBag.SupplierBuilder<T>
- Type Parameters:
T- the bean type
- Enclosing class:
- BeanBag
A builder for a bean supplier which constructs a bean using reflection.
-
Method Summary
Modifier and TypeMethodDescriptionaddConstructorArgument(BeanSupplier<?> supplier) Add a general constructor argument injection.addConstructorArgument(Class<?> injectType) Add a bean dependency constructor argument injection.addConstructorArgument(Class<?> injectType, boolean optional) Add a bean dependency constructor argument injection.addConstructorArgument(Class<?> injectType, String beanName) Add a bean dependency constructor argument injection.addConstructorArgument(Class<?> injectType, String beanName, boolean optional) Add a bean dependency constructor argument injection.addConstructorArgument(Class<?> injectType, String beanName, boolean optional, DependencyFilter filter) Add a bean dependency constructor argument injection.build()Commit this supplier definition into the enclosing bean builder.injectField(Field field) Add a bean dependency field injection.injectField(Field field, boolean optional) Add a bean dependency field injection.injectField(Field field, BeanSupplier<?> supplier) Add a general field injection.injectField(Field field, Class<?> injectType, String beanName, boolean optional, DependencyFilter filter) Add a bean dependency field injection.injectField(Field field, String beanName) Add a bean dependency field injection.injectField(Field field, String beanName, boolean optional) Add a bean dependency field injection.injectField(Field field, String beanName, boolean optional, DependencyFilter filter) Add a bean dependency field injection.injectMethod(Method method) Add a bean dependency method injection.injectMethod(Method method, boolean optional) Add a bean dependency method injection.injectMethod(Method method, BeanSupplier<?> supplier) Add a general method injection.injectMethod(Method method, Class<?> injectType, String beanName, boolean optional, DependencyFilter filter) Add a bean dependency method injection.injectMethod(Method method, String beanName) Add a bean dependency method injection.injectMethod(Method method, String beanName, boolean optional) Add a bean dependency method injection.injectMethod(Method method, String beanName, boolean optional, DependencyFilter filter) Add a bean dependency method injection.setConstructor(Constructor<T> constructor) Set the constructor to use to instantiate the bean.
-
Method Details
-
setConstructor
Set the constructor to use to instantiate the bean.- Parameters:
constructor- the constructor (must not benull)- Returns:
- this builder (not
null)
-
injectField
Add a general field injection.- Parameters:
field- the field to inject into (must not benull)supplier- the supplier of the field's value (must not benull)- Returns:
- this builder (not
null)
-
injectField
public BeanBag.SupplierBuilder<T> injectField(Field field, Class<?> injectType, String beanName, boolean optional, DependencyFilter filter) Add a bean dependency field injection.- Parameters:
field- the field to inject into (must not benull)injectType- the bean type to inject (must not benull)beanName- the bean name to inject or""for any (must not benull)optional-trueto allownullto be injected, orfalseotherwisefilter- the filter to apply to determine whether a given bean should be included (must not benull)- Returns:
- this builder (not
null)
-
injectField
Add a bean dependency field injection. The type of the bean is derived from the field's type.- Parameters:
field- the field to inject into (must not benull)- Returns:
- this builder (not
null)
-
injectField
Add a bean dependency field injection. The type of the bean is derived from the field's type.- Parameters:
field- the field to inject into (must not benull)beanName- the bean name to inject or""for any (must not benull)- Returns:
- this builder (not
null)
-
injectField
Add a bean dependency field injection. The type of the bean is derived from the field's type.- Parameters:
field- the field to inject into (must not benull)optional-trueto allownullto be injected, orfalseotherwise- Returns:
- this builder (not
null)
-
injectField
Add a bean dependency field injection. The type of the bean is derived from the field's type.- Parameters:
field- the field to inject into (must not benull)beanName- the bean name to inject or""for any (must not benull)optional-trueto allownullto be injected, orfalseotherwise- Returns:
- this builder (not
null)
-
injectField
public BeanBag.SupplierBuilder<T> injectField(Field field, String beanName, boolean optional, DependencyFilter filter) Add a bean dependency field injection. The type of the bean is derived from the field's type.- Parameters:
field- the field to inject into (must not benull)beanName- the bean name to inject or""for any (must not benull)optional-trueto allownullto be injected, orfalseotherwisefilter- the filter to apply to determine whether a given bean should be included (must not benull)- Returns:
- this builder (not
null)
-
injectMethod
Add a general method injection.- Parameters:
method- the method to inject into (must not benull)supplier- the supplier of the method's value (must not benull)- Returns:
- this builder (not
null)
-
injectMethod
public BeanBag.SupplierBuilder<T> injectMethod(Method method, Class<?> injectType, String beanName, boolean optional, DependencyFilter filter) Add a bean dependency method injection.- Parameters:
method- the method to inject into (must not benull)injectType- the bean type to inject (must not benull)beanName- the bean name to inject or""for any (must not benull)optional-trueto allownullto be injected, orfalseotherwisefilter- the filter to apply to determine whether a given bean should be included (must not benull)- Returns:
- this builder (not
null)
-
injectMethod
Add a bean dependency method injection. The type of the bean is derived from the method's sole argument type.- Parameters:
method- the method to inject into (must not benull)- Returns:
- this builder (not
null)
-
injectMethod
Add a bean dependency method injection. The type of the bean is derived from the method's sole argument type.- Parameters:
method- the method to inject into (must not benull)beanName- the bean name to inject or""for any (must not benull)- Returns:
- this builder (not
null)
-
injectMethod
Add a bean dependency method injection. The type of the bean is derived from the method's sole argument type.- Parameters:
method- the method to inject into (must not benull)optional-trueto allownullto be injected, orfalseotherwise- Returns:
- this builder (not
null)
-
injectMethod
Add a bean dependency method injection. The type of the bean is derived from the method's sole argument type.- Parameters:
method- the method to inject into (must not benull)beanName- the bean name to inject or""for any (must not benull)optional-trueto allownullto be injected, orfalseotherwise- Returns:
- this builder (not
null)
-
injectMethod
public BeanBag.SupplierBuilder<T> injectMethod(Method method, String beanName, boolean optional, DependencyFilter filter) Add a bean dependency method injection. The type of the bean is derived from the method's sole argument type.- Parameters:
method- the method to inject into (must not benull)beanName- the bean name to inject or""for any (must not benull)optional-trueto allownullto be injected, orfalseotherwisefilter- the filter to apply to determine whether a given bean should be included (must not benull)- Returns:
- this builder (not
null)
-
addConstructorArgument
Add a general constructor argument injection.- Parameters:
supplier- the supplier of the argument's value (must not benull)- Returns:
- this builder (not
null)
-
addConstructorArgument
Add a bean dependency constructor argument injection.- Parameters:
injectType- the bean type to inject (must not benull)- Returns:
- this builder (not
null)
-
addConstructorArgument
Add a bean dependency constructor argument injection.- Parameters:
injectType- the bean type to inject (must not benull)optional-trueto allownullto be injected, orfalseotherwise- Returns:
- this builder (not
null)
-
addConstructorArgument
Add a bean dependency constructor argument injection.- Parameters:
injectType- the bean type to inject (must not benull)beanName- the bean name to inject or""for any (must not benull)- Returns:
- this builder (not
null)
-
addConstructorArgument
public BeanBag.SupplierBuilder<T> addConstructorArgument(Class<?> injectType, String beanName, boolean optional) Add a bean dependency constructor argument injection.- Parameters:
injectType- the bean type to inject (must not benull)beanName- the bean name to inject or""for any (must not benull)optional-trueto allownullto be injected, orfalseotherwise- Returns:
- this builder (not
null)
-
addConstructorArgument
public BeanBag.SupplierBuilder<T> addConstructorArgument(Class<?> injectType, String beanName, boolean optional, DependencyFilter filter) Add a bean dependency constructor argument injection.- Parameters:
injectType- the bean type to inject (must not benull)beanName- the bean name to inject or""for any (must not benull)optional-trueto allownullto be injected, orfalseotherwisefilter- the filter to apply to determine whether a given bean should be included (must not benull)- Returns:
- this builder (not
null)
-
build
Commit this supplier definition into the enclosing bean builder. Any supplier previously set on the bean builder is overwritten.- Returns:
- the enclosing bean builder (not
null)
-