in alternative-modules/alternative-implementation-module/src/main/java/org/apache/myfaces/extensions/cdi/alternative/implementation/impl/AlternativeImplementationExtension.java [41:101]
protected <T> void vetoDefaultImplementation(@Observes ProcessAnnotatedType<T> processAnnotatedType)
{
Class<?> beanClass = processAnnotatedType.getAnnotatedType().getJavaClass();
//only filter default implementations of codi which are beans and don't filter a
//AlternativeImplementation provided by e.g. the codi alternative config module
if (!beanClass.getName().startsWith("org.apache.myfaces.extensions.cdi.") ||
beanClass.isAnnotationPresent(AlternativeImplementation.class) ||
beanClass.isAnnotationPresent(Specializes.class) ||
(beanClass.isAnnotationPresent(Typed.class) &&
beanClass.getAnnotation(Typed.class).value().length == 0))
{
return;
}
if (beanClass.isInterface() || Modifier.isAbstract(beanClass.getModifiers()))
{
return;
}
final boolean configClassMode = CodiConfig.class.isAssignableFrom(beanClass);
List<Class> spiClassCandidates = findSpiClassCandidates(beanClass);
List customImplementations = new ArrayList();
Object customImplementation = null;
for (Class spiClass : spiClassCandidates)
{
if (Serializable.class.isAssignableFrom(beanClass))
{
if(!CodiConfig.class.getName().equals(spiClass.getName()))
{
customImplementation = CodiUtils.lookupFromEnvironment(spiClass,
new ConfiguredClassAggregatable(spiClass, customImplementations, configClassMode));
}
else
{
customImplementation = CodiUtils.lookupFromEnvironment(spiClass,
new ConfiguredClassAggregatable(beanClass, customImplementations, configClassMode));
}
}
else
{
//noinspection unchecked
customImplementation = tryToLoadCustomClassViaServiceLoader(spiClass);
}
if (customImplementation != null)
{
break;
}
}
if (customImplementation != null)
{
//veto default implementation of codi
processAnnotatedType.veto();
}
}