T
- the class of the bean instancepublic interface BeanConfigurator<T>
Bean
instance.
CDI container must provides an implementation of this interface.
This builder is not thread safe and shall not be used concurrently.
CDI Lite implementations are not required to provide support for Portable Extensions.
AfterBeanDiscovery.addBean()
Modifier and Type | Method and Description |
---|---|
BeanConfigurator<T> |
addInjectionPoint(InjectionPoint injectionPoint)
Add an InjectionPoint to the configured bean
|
BeanConfigurator<T> |
addInjectionPoints(InjectionPoint... injectionPoints)
Add InjectionPoints to the configured bean
|
BeanConfigurator<T> |
addInjectionPoints(java.util.Set<InjectionPoint> injectionPoints)
Add InjectionPoints to the configured bean
|
BeanConfigurator<T> |
addQualifier(java.lang.annotation.Annotation qualifier)
Add a qualifier to the configured bean
|
BeanConfigurator<T> |
addQualifiers(java.lang.annotation.Annotation... qualifiers)
Add qualifiers to the bean.
|
BeanConfigurator<T> |
addQualifiers(java.util.Set<java.lang.annotation.Annotation> qualifiers)
Add qualifiers to the bean.
|
BeanConfigurator<T> |
addStereotype(java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
Add a stereotype to the configured bean
|
BeanConfigurator<T> |
addStereotypes(java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> stereotypes)
Add stereotypes to the configured bean
|
BeanConfigurator<T> |
addTransitiveTypeClosure(java.lang.reflect.Type type)
Adds an unrestricted set of bean types for the given type as if it represented a bean class of a managed bean.
|
BeanConfigurator<T> |
addType(java.lang.reflect.Type type)
Add a type to the bean types
|
BeanConfigurator<T> |
addType(TypeLiteral<?> typeLiteral)
Add a type to the bean types
|
BeanConfigurator<T> |
addTypes(java.util.Set<java.lang.reflect.Type> types)
Add types to the bean types
|
BeanConfigurator<T> |
addTypes(java.lang.reflect.Type... types)
Add types to the bean types
|
BeanConfigurator<T> |
alternative(boolean value)
Change the alternative status of the configured bean.
|
BeanConfigurator<T> |
beanClass(java.lang.Class<?> beanClass)
Set the class of the configured Bean.
|
<U extends T> |
createWith(java.util.function.Function<CreationalContext<U>,U> callback)
Set a callback to create a bean instance.
|
BeanConfigurator<T> |
destroyWith(java.util.function.BiConsumer<T,CreationalContext<T>> callback)
Set a callback to destroy a bean instance.
|
BeanConfigurator<T> |
disposeWith(java.util.function.BiConsumer<T,Instance<java.lang.Object>> callback)
Set a callback to destroy a bean instance.
|
BeanConfigurator<T> |
id(java.lang.String id)
Make the configured bean implements
PassivationCapable and its Id for passivation. |
BeanConfigurator<T> |
injectionPoints(InjectionPoint... injectionPoints)
Replace InjectionPoints for the configured bean
|
BeanConfigurator<T> |
injectionPoints(java.util.Set<InjectionPoint> injectionPoints)
Replace InjectionPoints for the configured bean
|
BeanConfigurator<T> |
name(java.lang.String name)
Set the name of the configured bean
|
BeanConfigurator<T> |
priority(int priority)
Set the priority of the configured bean.
|
<U extends T> |
produceWith(java.util.function.Function<Instance<java.lang.Object>,U> callback)
Set a callback to create a bean instance.
|
BeanConfigurator<T> |
qualifiers(java.lang.annotation.Annotation... qualifiers)
Replace all qualifiers.
|
BeanConfigurator<T> |
qualifiers(java.util.Set<java.lang.annotation.Annotation> qualifiers)
Replace all qualifiers.
|
<U extends T> |
read(AnnotatedType<U> type)
Read the information from the given annotated type.
|
BeanConfigurator<T> |
read(BeanAttributes<?> beanAttributes)
Read the information from the given bean attributes.
|
BeanConfigurator<T> |
scope(java.lang.Class<? extends java.lang.annotation.Annotation> scope)
Replace Bean scope
|
BeanConfigurator<T> |
stereotypes(java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> stereotypes)
Replace stereotypes on the configured bean
|
BeanConfigurator<T> |
types(java.util.Set<java.lang.reflect.Type> types)
Replace bean types
|
BeanConfigurator<T> |
types(java.lang.reflect.Type... types)
Replace bean types
|
BeanConfigurator<T> beanClass(java.lang.Class<?> beanClass)
beanClass
- class of the configured beanBeanConfigurator<T> addInjectionPoint(InjectionPoint injectionPoint)
injectionPoint
- the injectionPoint to addBeanConfigurator<T> addInjectionPoints(InjectionPoint... injectionPoints)
injectionPoints
- the injectionPoints to addBeanConfigurator<T> addInjectionPoints(java.util.Set<InjectionPoint> injectionPoints)
injectionPoints
- the injectionPoints to addBeanConfigurator<T> injectionPoints(InjectionPoint... injectionPoints)
injectionPoints
- the injectionPoints for the configured beanBeanConfigurator<T> injectionPoints(java.util.Set<InjectionPoint> injectionPoints)
injectionPoints
- the injectionPoints for the configured beanBeanConfigurator<T> id(java.lang.String id)
PassivationCapable
and its Id for passivation.id
- forPassivationCapable.getId()
<U extends T> BeanConfigurator<U> createWith(java.util.function.Function<CreationalContext<U>,U> callback)
U
- instance typecallback
- the callback to create the instanceContextual.create(CreationalContext)
<U extends T> BeanConfigurator<U> produceWith(java.util.function.Function<Instance<java.lang.Object>,U> callback)
The Instance
argument might be used to simulate producer method parameter injection. However, dependent scoped
bean instances obtained from Instance
during the callback execution remain managed until the produced bean
instance is destroyed. Therefore, applications are encouraged to always destroy unneeded dependent scoped bean instances
obtained from Instance
.
U
- instance typecallback
- the callback to create the instanceBeanConfigurator<T> destroyWith(java.util.function.BiConsumer<T,CreationalContext<T>> callback)
If no destroy callback is specified, a NOOP callback is automatically set.
callback
- the callback to destroy the instanceBeanConfigurator<T> disposeWith(java.util.function.BiConsumer<T,Instance<java.lang.Object>> callback)
If no dispose callback is specified, a NOOP callback is automatically set.
The Instance
argument might be used to simulate disposer method parameter injection. All dependent scoped bean
instances obtained from Instance
during the callback execution are destroyed when the execution completes.
callback
- the callback to dispose the instance<U extends T> BeanConfigurator<U> read(AnnotatedType<U> type)
U
- instance typetype
- class to read information fromBeanConfigurator<T> read(BeanAttributes<?> beanAttributes)
beanAttributes
- beanAttributes to read information fromBeanConfigurator<T> addType(java.lang.reflect.Type type)
type
- the type to addBeanConfigurator<T> addType(TypeLiteral<?> typeLiteral)
typeLiteral
- the type to addBeanConfigurator<T> addTypes(java.lang.reflect.Type... types)
types
- types to addBeanConfigurator<T> addTypes(java.util.Set<java.lang.reflect.Type> types)
types
- types to addBeanConfigurator<T> addTransitiveTypeClosure(java.lang.reflect.Type type)
type
- to build the closure fromBeanConfigurator<T> types(java.lang.reflect.Type... types)
types
- the types of the configured beanBeanConfigurator<T> types(java.util.Set<java.lang.reflect.Type> types)
types
- the types of the configured beanBeanConfigurator<T> scope(java.lang.Class<? extends java.lang.annotation.Annotation> scope)
scope
- new scope for the configured beanBeanConfigurator<T> addQualifier(java.lang.annotation.Annotation qualifier)
qualifier
- qualifier to addBeanConfigurator<T> addQualifiers(java.lang.annotation.Annotation... qualifiers)
qualifiers
- qualifiers to addBeanConfigurator<T> addQualifiers(java.util.Set<java.lang.annotation.Annotation> qualifiers)
qualifiers
- qualifiers to addBeanConfigurator<T> qualifiers(java.lang.annotation.Annotation... qualifiers)
qualifiers
- qualifiers for the build beanBeanConfigurator<T> qualifiers(java.util.Set<java.lang.annotation.Annotation> qualifiers)
qualifiers
- for the configured beanBeanConfigurator<T> addStereotype(java.lang.Class<? extends java.lang.annotation.Annotation> stereotype)
stereotype
- stereotype to addBeanConfigurator<T> addStereotypes(java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> stereotypes)
stereotypes
- stereotypes to addBeanConfigurator<T> stereotypes(java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> stereotypes)
stereotypes
- for the configured beanBeanConfigurator<T> name(java.lang.String name)
name
- name for the configured beanBeanConfigurator<T> alternative(boolean value)
value
- value for alternative propertyBeanConfigurator<T> priority(int priority)
This is equivalent to putting the Priority
annotation to an actual bean class or making a custom
Bean
class implement
Prioritized
.
This method has no effect if the configured bean is not an alternative.
priority
- the priority value