Class BeanConfiguratorImpl<T>
- java.lang.Object
-
- org.jboss.weld.bootstrap.events.configurator.BeanConfiguratorImpl<T>
-
- Type Parameters:
T-
- All Implemented Interfaces:
BeanConfigurator<T>,WeldBeanConfigurator<T>,Configurator<Bean<T>>
public class BeanConfiguratorImpl<T> extends Object implements WeldBeanConfigurator<T>, Configurator<Bean<T>>
- Author:
- Martin Kouba
-
-
Constructor Summary
Constructors Constructor Description BeanConfiguratorImpl(Class<?> defaultBeanClass, BeanDeploymentFinder beanDeploymentFinder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WeldBeanConfigurator<T>addInjectionPoint(InjectionPoint injectionPoint)Add an InjectionPoint to the configured beanWeldBeanConfigurator<T>addInjectionPoints(Set<InjectionPoint> injectionPoints)Add InjectionPoints to the configured beanWeldBeanConfigurator<T>addInjectionPoints(InjectionPoint... injectionPoints)Add InjectionPoints to the configured beanWeldBeanConfigurator<T>addQualifier(Annotation qualifier)Add a qualifier to the configured beanWeldBeanConfigurator<T>addQualifiers(Annotation... qualifiers)Add qualifiers to the bean.WeldBeanConfigurator<T>addQualifiers(Set<Annotation> qualifiers)Add qualifiers to the bean.WeldBeanConfigurator<T>addStereotype(Class<? extends Annotation> stereotype)Add a stereotype to the configured beanWeldBeanConfigurator<T>addStereotypes(Set<Class<? extends Annotation>> stereotypes)Add stereotypes to the configured beanWeldBeanConfigurator<T>addTransitiveTypeClosure(Type type)Adds an unrestricted set of bean types for the given type as if it represented a bean class of a managed bean.WeldBeanConfigurator<T>addType(Type type)Add a type to the bean typesWeldBeanConfigurator<T>addType(TypeLiteral<?> typeLiteral)Add a type to the bean typesWeldBeanConfigurator<T>addTypes(Type... types)Add types to the bean typesWeldBeanConfigurator<T>addTypes(Set<Type> types)Add types to the bean typesWeldBeanConfigurator<T>alternative(boolean alternative)Change the alternative status of the configured bean.WeldBeanConfigurator<T>beanClass(Class<?> beanClass)Set the class of the configured Bean.Bean<T>complete()Returns a finished component.<U extends T>
WeldBeanConfigurator<U>createWith(Function<CreationalContext<U>,U> callback)Set a callback to create a bean instance.WeldBeanConfigurator<T>destroyWith(BiConsumer<T,CreationalContext<T>> callback)Set a callback to destroy a bean instance.WeldBeanConfigurator<T>disposeWith(BiConsumer<T,Instance<Object>> callback)Set a callback to destroy a bean instance.BeanManagerImplgetBeanManager()WeldBeanConfigurator<T>id(String id)Make the configured bean implementsPassivationCapableand its Id for passivation.WeldBeanConfigurator<T>injectionPoints(Set<InjectionPoint> injectionPoints)Replace InjectionPoints for the configured beanWeldBeanConfigurator<T>injectionPoints(InjectionPoint... injectionPoints)Replace InjectionPoints for the configured beanWeldBeanConfigurator<T>name(String name)Set the name of the configured beanWeldBeanConfigurator<T>priority(int priority)Allows to set a priority to an alternative bean hence selecting it globally.<U extends T>
WeldBeanConfigurator<U>produceWith(Function<Instance<Object>,U> callback)Set a callback to create a bean instance.WeldBeanConfigurator<T>qualifiers(Annotation... qualifiers)Replace all qualifiers.WeldBeanConfigurator<T>qualifiers(Set<Annotation> qualifiers)Replace all qualifiers.<U extends T>
WeldBeanConfigurator<U>read(AnnotatedType<U> type)Read the information from the given annotated type.WeldBeanConfigurator<T>read(BeanAttributes<?> beanAttributes)Read the information from the given bean attributes.WeldBeanConfigurator<T>scope(Class<? extends Annotation> scope)Replace Bean scopeWeldBeanConfigurator<T>stereotypes(Set<Class<? extends Annotation>> stereotypes)Replace stereotypes on the configured beanWeldBeanConfigurator<T>types(Type... types)Replace bean typesWeldBeanConfigurator<T>types(Set<Type> types)Replace bean types
-
-
-
Constructor Detail
-
BeanConfiguratorImpl
public BeanConfiguratorImpl(Class<?> defaultBeanClass, BeanDeploymentFinder beanDeploymentFinder)
- Parameters:
defaultBeanClass-beanDeploymentFinder-
-
-
Method Detail
-
priority
public WeldBeanConfigurator<T> priority(int priority)
Description copied from interface:WeldBeanConfiguratorAllows to set a priority to an alternative bean hence selecting it globally. Has the same effect as puttingInterceptor.Priorityannotation on an actual bean class or implementingPrioritizedinterface with custom bean classes. This method has no effect on custom beans which are not alternatives.- Specified by:
priorityin interfaceWeldBeanConfigurator<T>- Parameters:
priority- the priority of this bean- Returns:
- self
-
beanClass
public WeldBeanConfigurator<T> beanClass(Class<?> beanClass)
Description copied from interface:BeanConfiguratorSet the class of the configured Bean. If not set, the extension class is used.- Specified by:
beanClassin interfaceBeanConfigurator<T>- Specified by:
beanClassin interfaceWeldBeanConfigurator<T>- Parameters:
beanClass- class of the configured bean- Returns:
- self
-
addInjectionPoint
public WeldBeanConfigurator<T> addInjectionPoint(InjectionPoint injectionPoint)
Description copied from interface:BeanConfiguratorAdd an InjectionPoint to the configured bean- Specified by:
addInjectionPointin interfaceBeanConfigurator<T>- Specified by:
addInjectionPointin interfaceWeldBeanConfigurator<T>- Parameters:
injectionPoint- the injectionPoint to add- Returns:
- self
-
addInjectionPoints
public WeldBeanConfigurator<T> addInjectionPoints(InjectionPoint... injectionPoints)
Description copied from interface:BeanConfiguratorAdd InjectionPoints to the configured bean- Specified by:
addInjectionPointsin interfaceBeanConfigurator<T>- Specified by:
addInjectionPointsin interfaceWeldBeanConfigurator<T>- Parameters:
injectionPoints- the injectionPoints to add- Returns:
- self
-
addInjectionPoints
public WeldBeanConfigurator<T> addInjectionPoints(Set<InjectionPoint> injectionPoints)
Description copied from interface:BeanConfiguratorAdd InjectionPoints to the configured bean- Specified by:
addInjectionPointsin interfaceBeanConfigurator<T>- Specified by:
addInjectionPointsin interfaceWeldBeanConfigurator<T>- Parameters:
injectionPoints- the injectionPoints to add- Returns:
- self
-
injectionPoints
public WeldBeanConfigurator<T> injectionPoints(InjectionPoint... injectionPoints)
Description copied from interface:BeanConfiguratorReplace InjectionPoints for the configured bean- Specified by:
injectionPointsin interfaceBeanConfigurator<T>- Specified by:
injectionPointsin interfaceWeldBeanConfigurator<T>- Parameters:
injectionPoints- the injectionPoints for the configured bean- Returns:
- self
-
injectionPoints
public WeldBeanConfigurator<T> injectionPoints(Set<InjectionPoint> injectionPoints)
Description copied from interface:BeanConfiguratorReplace InjectionPoints for the configured bean- Specified by:
injectionPointsin interfaceBeanConfigurator<T>- Specified by:
injectionPointsin interfaceWeldBeanConfigurator<T>- Parameters:
injectionPoints- the injectionPoints for the configured bean- Returns:
- self
-
id
public WeldBeanConfigurator<T> id(String id)
Description copied from interface:BeanConfiguratorMake the configured bean implementsPassivationCapableand its Id for passivation.- Specified by:
idin interfaceBeanConfigurator<T>- Specified by:
idin interfaceWeldBeanConfigurator<T>- Parameters:
id- for- Returns:
- self
- See Also:
PassivationCapable.getId()
-
createWith
public <U extends T> WeldBeanConfigurator<U> createWith(Function<CreationalContext<U>,U> callback)
Description copied from interface:BeanConfiguratorSet a callback to create a bean instance.- Specified by:
createWithin interfaceBeanConfigurator<T>- Specified by:
createWithin interfaceWeldBeanConfigurator<T>- Parameters:
callback- the callback to create the instance- Returns:
- self
- See Also:
Contextual.create(CreationalContext)
-
produceWith
public <U extends T> WeldBeanConfigurator<U> produceWith(Function<Instance<Object>,U> callback)
Description copied from interface:BeanConfiguratorSet 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.- Specified by:
produceWithin interfaceBeanConfigurator<T>- Specified by:
produceWithin interfaceWeldBeanConfigurator<T>- Parameters:
callback- the callback to create the instance- Returns:
- self
-
destroyWith
public WeldBeanConfigurator<T> destroyWith(BiConsumer<T,CreationalContext<T>> callback)
Description copied from interface:BeanConfiguratorSet a callback to destroy a bean instance.If no destroy callback is specified, a NOOP callback is automatically set.
- Specified by:
destroyWithin interfaceBeanConfigurator<T>- Specified by:
destroyWithin interfaceWeldBeanConfigurator<T>- Parameters:
callback- the callback to destroy the instance- Returns:
- self
-
disposeWith
public WeldBeanConfigurator<T> disposeWith(BiConsumer<T,Instance<Object>> callback)
Description copied from interface:BeanConfiguratorSet 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.- Specified by:
disposeWithin interfaceBeanConfigurator<T>- Specified by:
disposeWithin interfaceWeldBeanConfigurator<T>- Parameters:
callback- the callback to dispose the instance- Returns:
- self
-
read
public <U extends T> WeldBeanConfigurator<U> read(AnnotatedType<U> type)
Description copied from interface:BeanConfiguratorRead the information from the given annotated type. All relevant information is overwritten.- Specified by:
readin interfaceBeanConfigurator<T>- Specified by:
readin interfaceWeldBeanConfigurator<T>- Parameters:
type- class to read information from- Returns:
- self
-
read
public WeldBeanConfigurator<T> read(BeanAttributes<?> beanAttributes)
Description copied from interface:BeanConfiguratorRead the information from the given bean attributes. All relevant information is overwritten.- Specified by:
readin interfaceBeanConfigurator<T>- Specified by:
readin interfaceWeldBeanConfigurator<T>- Parameters:
beanAttributes- beanAttributes to read information from- Returns:
- self
-
addType
public WeldBeanConfigurator<T> addType(Type type)
Description copied from interface:BeanConfiguratorAdd a type to the bean types- Specified by:
addTypein interfaceBeanConfigurator<T>- Specified by:
addTypein interfaceWeldBeanConfigurator<T>- Parameters:
type- the type to add- Returns:
- self
-
addType
public WeldBeanConfigurator<T> addType(TypeLiteral<?> typeLiteral)
Description copied from interface:BeanConfiguratorAdd a type to the bean types- Specified by:
addTypein interfaceBeanConfigurator<T>- Specified by:
addTypein interfaceWeldBeanConfigurator<T>- Parameters:
typeLiteral- the type to add- Returns:
- self
-
addTypes
public WeldBeanConfigurator<T> addTypes(Type... types)
Description copied from interface:BeanConfiguratorAdd types to the bean types- Specified by:
addTypesin interfaceBeanConfigurator<T>- Specified by:
addTypesin interfaceWeldBeanConfigurator<T>- Parameters:
types- types to add- Returns:
- self
-
addTypes
public WeldBeanConfigurator<T> addTypes(Set<Type> types)
Description copied from interface:BeanConfiguratorAdd types to the bean types- Specified by:
addTypesin interfaceBeanConfigurator<T>- Specified by:
addTypesin interfaceWeldBeanConfigurator<T>- Parameters:
types- types to add- Returns:
- self
-
addTransitiveTypeClosure
public WeldBeanConfigurator<T> addTransitiveTypeClosure(Type type)
Description copied from interface:BeanConfiguratorAdds 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.- Specified by:
addTransitiveTypeClosurein interfaceBeanConfigurator<T>- Specified by:
addTransitiveTypeClosurein interfaceWeldBeanConfigurator<T>- Parameters:
type- to build the closure from- Returns:
- self
-
types
public WeldBeanConfigurator<T> types(Type... types)
Description copied from interface:BeanConfiguratorReplace bean types- Specified by:
typesin interfaceBeanConfigurator<T>- Specified by:
typesin interfaceWeldBeanConfigurator<T>- Parameters:
types- the types of the configured bean- Returns:
- self
-
types
public WeldBeanConfigurator<T> types(Set<Type> types)
Description copied from interface:BeanConfiguratorReplace bean types- Specified by:
typesin interfaceBeanConfigurator<T>- Specified by:
typesin interfaceWeldBeanConfigurator<T>- Parameters:
types- the types of the configured bean- Returns:
- self
-
scope
public WeldBeanConfigurator<T> scope(Class<? extends Annotation> scope)
Description copied from interface:BeanConfiguratorReplace Bean scope- Specified by:
scopein interfaceBeanConfigurator<T>- Specified by:
scopein interfaceWeldBeanConfigurator<T>- Parameters:
scope- new scope for the configured bean- Returns:
- self
-
addQualifier
public WeldBeanConfigurator<T> addQualifier(Annotation qualifier)
Description copied from interface:BeanConfiguratorAdd a qualifier to the configured bean- Specified by:
addQualifierin interfaceBeanConfigurator<T>- Specified by:
addQualifierin interfaceWeldBeanConfigurator<T>- Parameters:
qualifier- qualifier to add- Returns:
- self
-
addQualifiers
public WeldBeanConfigurator<T> addQualifiers(Annotation... qualifiers)
Description copied from interface:BeanConfiguratorAdd qualifiers to the bean.- Specified by:
addQualifiersin interfaceBeanConfigurator<T>- Specified by:
addQualifiersin interfaceWeldBeanConfigurator<T>- Parameters:
qualifiers- qualifiers to add- Returns:
- self
-
addQualifiers
public WeldBeanConfigurator<T> addQualifiers(Set<Annotation> qualifiers)
Description copied from interface:BeanConfiguratorAdd qualifiers to the bean.- Specified by:
addQualifiersin interfaceBeanConfigurator<T>- Specified by:
addQualifiersin interfaceWeldBeanConfigurator<T>- Parameters:
qualifiers- qualifiers to add- Returns:
- self
-
qualifiers
public WeldBeanConfigurator<T> qualifiers(Annotation... qualifiers)
Description copied from interface:BeanConfiguratorReplace all qualifiers.- Specified by:
qualifiersin interfaceBeanConfigurator<T>- Specified by:
qualifiersin interfaceWeldBeanConfigurator<T>- Parameters:
qualifiers- qualifiers for the build bean- Returns:
- self
-
qualifiers
public WeldBeanConfigurator<T> qualifiers(Set<Annotation> qualifiers)
Description copied from interface:BeanConfiguratorReplace all qualifiers.- Specified by:
qualifiersin interfaceBeanConfigurator<T>- Specified by:
qualifiersin interfaceWeldBeanConfigurator<T>- Parameters:
qualifiers- for the configured bean- Returns:
- self
-
addStereotype
public WeldBeanConfigurator<T> addStereotype(Class<? extends Annotation> stereotype)
Description copied from interface:BeanConfiguratorAdd a stereotype to the configured bean- Specified by:
addStereotypein interfaceBeanConfigurator<T>- Specified by:
addStereotypein interfaceWeldBeanConfigurator<T>- Parameters:
stereotype- stereotype to add- Returns:
- self
-
addStereotypes
public WeldBeanConfigurator<T> addStereotypes(Set<Class<? extends Annotation>> stereotypes)
Description copied from interface:BeanConfiguratorAdd stereotypes to the configured bean- Specified by:
addStereotypesin interfaceBeanConfigurator<T>- Specified by:
addStereotypesin interfaceWeldBeanConfigurator<T>- Parameters:
stereotypes- stereotypes to add- Returns:
- self
-
stereotypes
public WeldBeanConfigurator<T> stereotypes(Set<Class<? extends Annotation>> stereotypes)
Description copied from interface:BeanConfiguratorReplace stereotypes on the configured bean- Specified by:
stereotypesin interfaceBeanConfigurator<T>- Specified by:
stereotypesin interfaceWeldBeanConfigurator<T>- Parameters:
stereotypes- for the configured bean- Returns:
- self
-
name
public WeldBeanConfigurator<T> name(String name)
Description copied from interface:BeanConfiguratorSet the name of the configured bean- Specified by:
namein interfaceBeanConfigurator<T>- Specified by:
namein interfaceWeldBeanConfigurator<T>- Parameters:
name- name for the configured bean- Returns:
- self
-
alternative
public WeldBeanConfigurator<T> alternative(boolean alternative)
Description copied from interface:BeanConfiguratorChange the alternative status of the configured bean. By default the configured bean is not an alternative.- Specified by:
alternativein interfaceBeanConfigurator<T>- Specified by:
alternativein interfaceWeldBeanConfigurator<T>- Parameters:
alternative- value for alternative property- Returns:
- self
-
complete
public Bean<T> complete()
Description copied from interface:ConfiguratorReturns a finished component.- Specified by:
completein interfaceConfigurator<T>- Returns:
- a finished component
-
getBeanManager
public BeanManagerImpl getBeanManager()
-
-