in jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/phase/PhaseListenerExtension.java [102:152]
public static List<PhaseListener> consumePhaseListeners()
{
//workaround for mojarra
CodiStartupBroadcaster.broadcastStartup();
ClassLoader classLoader = getClassLoader();
List<Class<? extends PhaseListener>> foundPhaseListeners = phaseListeners.get(classLoader);
boolean advancedQualifierRequiredForDependencyInjection =
CodiUtils.getContextualReferenceByClass(CodiCoreConfig.class)
.isAdvancedQualifierRequiredForDependencyInjection();
if(foundPhaseListeners != null && ! foundPhaseListeners.isEmpty())
{
List<PhaseListener> result = new ArrayList<PhaseListener>(foundPhaseListeners.size());
Class<? extends ProjectStage> activeProjectStage =
ProjectStageProducer.getInstance().getProjectStage().getClass();
for(Class<? extends PhaseListener> phaseListenerClass : foundPhaseListeners)
{
if(phaseListenerClass.isAnnotationPresent(ProjectStageActivated.class))
{
boolean projectStageFound = false;
for(Class<? extends ProjectStage> currentProjectStage :
phaseListenerClass.getAnnotation(ProjectStageActivated.class).value())
{
if(currentProjectStage.isAssignableFrom(activeProjectStage))
{
projectStageFound = true;
}
}
if(!projectStageFound)
{
continue;
}
}
PhaseListener phaseListener = createPhaseListenerInstance(phaseListenerClass);
result.add(injectFields(phaseListener, advancedQualifierRequiredForDependencyInjection));
}
foundPhaseListeners.clear();
Collections.sort(result, new InvocationOrderComparator<PhaseListener>());
return result;
}
return Collections.emptyList();
}