in deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/ViewConfigExtension.java [187:264]
protected void addConfigClass(Class viewConfigClass, Set<Annotation> viewConfigAnnotations)
{
if (isInternal(viewConfigClass))
{
return;
}
String className = viewConfigClass.getName();
if (!className.contains("."))
{
if (className.contains("$"))
{
className = className.substring(0, className.indexOf("$"));
}
throw new IllegalStateException("Please move the class '" + className + "' to a package!");
}
for (Annotation annotation : viewConfigAnnotations)
{
if (annotation.annotationType().equals(ViewConfigRoot.class))
{
if (this.rootViewConfigNode.getSource() != null)
{
throw new IllegalStateException("@" + ViewConfigRoot.class.getName() + " has been found at " +
viewConfigClass.getName() + " and " + this.rootViewConfigNode.getSource().getName());
}
this.rootViewConfigNode.getMetaData().add(annotation);
this.rootViewConfigNode = new FolderConfigNode(this.rootViewConfigNode, viewConfigClass);
//needed for cdi 1.1+ with bean-discovery-mode 'annotated'
if (viewConfigClass.getAnnotation(ApplicationScoped.class) != null)
{
Set<Class> manuallyDiscoveredViewConfigs = new HashSet<Class>();
findNestedClasses(viewConfigClass, manuallyDiscoveredViewConfigs);
for (Class foundClass : manuallyDiscoveredViewConfigs)
{
buildViewConfigMetaDataTreeFor(
foundClass,
new HashSet<Annotation>(Arrays.asList(foundClass.getAnnotations())),
new VetoCallback() {
@Override
public void veto()
{
}
});
}
}
break;
}
}
List<Class> treePath = ViewConfigUtils.toNodeList(viewConfigClass);
ViewConfigNode previousRootNode = null;
for (Class currentNode : treePath)
{
//can only return a node if a folder was added already
ViewConfigNode baseNode = findNode(currentNode);
if (baseNode == null)
{
Set<Annotation> metaData = viewConfigAnnotations;
if (!currentNode.equals(viewConfigClass)) //small tweak
{
metaData = new HashSet<Annotation>(Arrays.asList(currentNode.getAnnotations()));
}
previousRootNode = addNode(previousRootNode, currentNode, metaData);
}
else
{
previousRootNode = baseNode;
}
}
}