- 
- Type Parameters:
- T- the class of the bean instance
 
 public interface BeanConfigurator<T>This API is an helper to configure a newBeaninstance. 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. - Since:
- 2.0
- Author:
- Martin Kouba, Antoine Sabot-Durand
- See Also:
- AfterBeanDiscovery.addBean()
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description BeanConfigurator<T>addInjectionPoint(InjectionPoint injectionPoint)Add an InjectionPoint to the configured beanBeanConfigurator<T>addInjectionPoints(InjectionPoint... injectionPoints)Add InjectionPoints to the configured beanBeanConfigurator<T>addInjectionPoints(java.util.Set<InjectionPoint> injectionPoints)Add InjectionPoints to the configured beanBeanConfigurator<T>addQualifier(java.lang.annotation.Annotation qualifier)Add a qualifier to the configured beanBeanConfigurator<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 beanBeanConfigurator<T>addStereotypes(java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> stereotypes)Add stereotypes to the configured beanBeanConfigurator<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(TypeLiteral<?> typeLiteral)Add a type to the bean typesBeanConfigurator<T>addType(java.lang.reflect.Type type)Add a type to the bean typesBeanConfigurator<T>addTypes(java.lang.reflect.Type... types)Add types to the bean typesBeanConfigurator<T>addTypes(java.util.Set<java.lang.reflect.Type> types)Add types to the bean typesBeanConfigurator<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>
 BeanConfigurator<U>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 implementsPassivationCapableand its Id for passivation.BeanConfigurator<T>injectionPoints(InjectionPoint... injectionPoints)Replace InjectionPoints for the configured beanBeanConfigurator<T>injectionPoints(java.util.Set<InjectionPoint> injectionPoints)Replace InjectionPoints for the configured beanBeanConfigurator<T>name(java.lang.String name)Set the name of the configured beanBeanConfigurator<T>priority(int priority)Set the priority of the configured bean.<U extends T>
 BeanConfigurator<U>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>
 BeanConfigurator<U>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 scopeBeanConfigurator<T>stereotypes(java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> stereotypes)Replace stereotypes on the configured beanBeanConfigurator<T>types(java.lang.reflect.Type... types)Replace bean typesBeanConfigurator<T>types(java.util.Set<java.lang.reflect.Type> types)Replace bean types
 
- 
- 
- 
Method Detail- 
beanClassBeanConfigurator<T> beanClass(java.lang.Class<?> beanClass) Set the class of the configured Bean. If not set, the extension class is used.- Parameters:
- beanClass- class of the configured bean
- Returns:
- self
 
 - 
addInjectionPointBeanConfigurator<T> addInjectionPoint(InjectionPoint injectionPoint) Add an InjectionPoint to the configured bean- Parameters:
- injectionPoint- the injectionPoint to add
- Returns:
- self
 
 - 
addInjectionPointsBeanConfigurator<T> addInjectionPoints(InjectionPoint... injectionPoints) Add InjectionPoints to the configured bean- Parameters:
- injectionPoints- the injectionPoints to add
- Returns:
- self
 
 - 
addInjectionPointsBeanConfigurator<T> addInjectionPoints(java.util.Set<InjectionPoint> injectionPoints) Add InjectionPoints to the configured bean- Parameters:
- injectionPoints- the injectionPoints to add
- Returns:
- self
 
 - 
injectionPointsBeanConfigurator<T> injectionPoints(InjectionPoint... injectionPoints) Replace InjectionPoints for the configured bean- Parameters:
- injectionPoints- the injectionPoints for the configured bean
- Returns:
- self
 
 - 
injectionPointsBeanConfigurator<T> injectionPoints(java.util.Set<InjectionPoint> injectionPoints) Replace InjectionPoints for the configured bean- Parameters:
- injectionPoints- the injectionPoints for the configured bean
- Returns:
- self
 
 - 
idBeanConfigurator<T> id(java.lang.String id) Make the configured bean implementsPassivationCapableand its Id for passivation.- Parameters:
- id- for
- Returns:
- self
- See Also:
- PassivationCapable.getId()
 
 - 
createWith<U extends T> BeanConfigurator<U> createWith(java.util.function.Function<CreationalContext<U>,U> callback) Set a callback to create a bean instance.- Type Parameters:
- U- instance type
- Parameters:
- callback- the callback to create the instance
- Returns:
- self
- See Also:
- Contextual.create(CreationalContext)
 
 - 
produceWith<U extends T> BeanConfigurator<U> produceWith(java.util.function.Function<Instance<java.lang.Object>,U> callback) Set a callback to create a bean instance.The Instanceargument might be used to simulate producer method parameter injection. However, dependent scoped bean instances obtained fromInstanceduring 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 fromInstance.- Type Parameters:
- U- instance type
- Parameters:
- callback- the callback to create the instance
- Returns:
- self
 
 - 
destroyWithBeanConfigurator<T> destroyWith(java.util.function.BiConsumer<T,CreationalContext<T>> callback) Set a callback to destroy a bean instance.If no destroy callback is specified, a NOOP callback is automatically set. - Parameters:
- callback- the callback to destroy the instance
- Returns:
- self
 
 - 
disposeWithBeanConfigurator<T> disposeWith(java.util.function.BiConsumer<T,Instance<java.lang.Object>> callback) Set a callback to destroy a bean instance.If no dispose callback is specified, a NOOP callback is automatically set. The Instanceargument might be used to simulate disposer method parameter injection. All dependent scoped bean instances obtained fromInstanceduring the callback execution are destroyed when the execution completes.- Parameters:
- callback- the callback to dispose the instance
- Returns:
- self
 
 - 
read<U extends T> BeanConfigurator<U> read(AnnotatedType<U> type) Read the information from the given annotated type. All relevant information is overwritten.- Type Parameters:
- U- instance type
- Parameters:
- type- class to read information from
- Returns:
- self
 
 - 
readBeanConfigurator<T> read(BeanAttributes<?> beanAttributes) Read the information from the given bean attributes. All relevant information is overwritten.- Parameters:
- beanAttributes- beanAttributes to read information from
- Returns:
- self
 
 - 
addTypeBeanConfigurator<T> addType(java.lang.reflect.Type type) Add a type to the bean types- Parameters:
- type- the type to add
- Returns:
- self
 
 - 
addTypeBeanConfigurator<T> addType(TypeLiteral<?> typeLiteral) Add a type to the bean types- Parameters:
- typeLiteral- the type to add
- Returns:
- self
 
 - 
addTypesBeanConfigurator<T> addTypes(java.lang.reflect.Type... types) Add types to the bean types- Parameters:
- types- types to add
- Returns:
- self
 
 - 
addTypesBeanConfigurator<T> addTypes(java.util.Set<java.lang.reflect.Type> types) Add types to the bean types- Parameters:
- types- types to add
- Returns:
- self
 
 - 
addTransitiveTypeClosureBeanConfigurator<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. Illegal bean types are omitted.- Parameters:
- type- to build the closure from
- Returns:
- self
 
 - 
typesBeanConfigurator<T> types(java.lang.reflect.Type... types) Replace bean types- Parameters:
- types- the types of the configured bean
- Returns:
- self
 
 - 
typesBeanConfigurator<T> types(java.util.Set<java.lang.reflect.Type> types) Replace bean types- Parameters:
- types- the types of the configured bean
- Returns:
- self
 
 - 
scopeBeanConfigurator<T> scope(java.lang.Class<? extends java.lang.annotation.Annotation> scope) Replace Bean scope- Parameters:
- scope- new scope for the configured bean
- Returns:
- self
 
 - 
addQualifierBeanConfigurator<T> addQualifier(java.lang.annotation.Annotation qualifier) Add a qualifier to the configured bean- Parameters:
- qualifier- qualifier to add
- Returns:
- self
 
 - 
addQualifiersBeanConfigurator<T> addQualifiers(java.lang.annotation.Annotation... qualifiers) Add qualifiers to the bean.- Parameters:
- qualifiers- qualifiers to add
- Returns:
- self
 
 - 
addQualifiersBeanConfigurator<T> addQualifiers(java.util.Set<java.lang.annotation.Annotation> qualifiers) Add qualifiers to the bean.- Parameters:
- qualifiers- qualifiers to add
- Returns:
- self
 
 - 
qualifiersBeanConfigurator<T> qualifiers(java.lang.annotation.Annotation... qualifiers) Replace all qualifiers.- Parameters:
- qualifiers- qualifiers for the build bean
- Returns:
- self
 
 - 
qualifiersBeanConfigurator<T> qualifiers(java.util.Set<java.lang.annotation.Annotation> qualifiers) Replace all qualifiers.- Parameters:
- qualifiers- for the configured bean
- Returns:
- self
 
 - 
addStereotypeBeanConfigurator<T> addStereotype(java.lang.Class<? extends java.lang.annotation.Annotation> stereotype) Add a stereotype to the configured bean- Parameters:
- stereotype- stereotype to add
- Returns:
- self
 
 - 
addStereotypesBeanConfigurator<T> addStereotypes(java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> stereotypes) Add stereotypes to the configured bean- Parameters:
- stereotypes- stereotypes to add
- Returns:
- self
 
 - 
stereotypesBeanConfigurator<T> stereotypes(java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> stereotypes) Replace stereotypes on the configured bean- Parameters:
- stereotypes- for the configured bean
- Returns:
- self
 
 - 
nameBeanConfigurator<T> name(java.lang.String name) Set the name of the configured bean- Parameters:
- name- name for the configured bean
- Returns:
- self
 
 - 
alternativeBeanConfigurator<T> alternative(boolean value) Change the alternative status of the configured bean. By default the configured bean is not an alternative.- Parameters:
- value- value for alternative property
- Returns:
- self
 
 - 
priorityBeanConfigurator<T> priority(int priority) Set the priority of the configured bean. By default, the configured bean does not have a priority.This is equivalent to putting the Priorityannotation to an actual bean class or making a customBeanclass implementPrioritized.This method has no effect if the configured bean is not an alternative. - Parameters:
- priority- the priority value
- Returns:
- self
 
 
- 
 
-