Package org.apache.webbeans.inject
Class AlternativesManager
- java.lang.Object
-
- org.apache.webbeans.inject.AlternativesManager
-
public class AlternativesManager extends Object
This class has 2 responsibilities. 1.) to collect information about configured @Alternatives at boot time 2.) answer if a class is an enabled Alternative. This is needed forBeanManagerImpl.resolve(java.util.Set)The boot order for 1.) is to first register all the alternatives and stereotypes from the XML. After that the AnnotatedType scanning is performed and all @Alternatives with @Priority get added as well. We will also add classes which have an Alternative stereotype. After the AnnotatedTypes got scanned we have to fire theAfterTypeDiscoveryevent with the collected effective alternative classes sorted by their priority. Any extension can re-order the alternatives which then form the base of the resolve() handling at runtime.
-
-
Constructor Summary
Constructors Constructor Description AlternativesManager(WebBeansContext webBeansContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPrioritizedAlternativeBean(javax.enterprise.inject.spi.Bean<?> prioritizedBean)This method is used to add Alternative Beans which implement thePrioritizedinterface This is performed after the Bean get's added.voidaddPriorityClazzAlternative(Class<?> clazz, Priority priority)This method is used to add Alternatives which have a @Priority annotation.voidaddXmlClazzAlternative(Class<?> alternative)This methods gets called while scanning the various beans.xml files.voidaddXmlStereoTypeAlternative(Class<?> alternative)This methods gets called while scanning the various beans.xml files.voidclear()List<Class<?>>getPrioritizedAlternatives()Alternatives get ordered by their priority and as lowest priority all the alternatives added via XML get added.Set<Class<?>>getXmlConfiguredAlternatives()booleanisAlternative(Class<?> beanType, Set<Class<? extends Annotation>> stereotypes)booleanisAlternative(javax.enterprise.inject.spi.Bean<?> bean)booleanisAlternativeStereotype(Class<? extends Annotation> stereo)
-
-
-
Constructor Detail
-
AlternativesManager
public AlternativesManager(WebBeansContext webBeansContext)
-
-
Method Detail
-
addXmlStereoTypeAlternative
public void addXmlStereoTypeAlternative(Class<?> alternative)
This methods gets called while scanning the various beans.xml files. It registers a <stereotype> alternative.
-
addXmlClazzAlternative
public void addXmlClazzAlternative(Class<?> alternative)
This methods gets called while scanning the various beans.xml files. It registers a <class> alternative.
-
addPriorityClazzAlternative
public void addPriorityClazzAlternative(Class<?> clazz, Priority priority)
This method is used to add Alternatives which have a @Priority annotation. This is performed after the ProcessAnnotatedType events got fired.
-
addPrioritizedAlternativeBean
public void addPrioritizedAlternativeBean(javax.enterprise.inject.spi.Bean<?> prioritizedBean)
This method is used to add Alternative Beans which implement thePrioritizedinterface This is performed after the Bean get's added.
-
getPrioritizedAlternatives
public List<Class<?>> getPrioritizedAlternatives()
Alternatives get ordered by their priority and as lowest priority all the alternatives added via XML get added.- Returns:
- the list of sorted alternatives
-
isAlternative
public boolean isAlternative(javax.enterprise.inject.spi.Bean<?> bean)
- Returns:
trueif the given bean is a configured alternative
-
isAlternative
public boolean isAlternative(Class<?> beanType, Set<Class<? extends Annotation>> stereotypes)
- Returns:
trueif the given bean is a configured alternative
-
getXmlConfiguredAlternatives
public Set<Class<?>> getXmlConfiguredAlternatives()
- Returns:
- all the alternative classes declared in beans.xml files
-
isAlternativeStereotype
public boolean isAlternativeStereotype(Class<? extends Annotation> stereo)
-
clear
public void clear()
-
-