String defaultExtension = ExtractedViewConfigDefinitionEntry.DEFAULT_EXTENSION;
String defaultPageName = ExtractedViewConfigDefinitionEntry.DEFAULT_PAGE_NAME;
String rootPath = ExtractedViewConfigDefinitionEntry.ROOT_PATH;
String currentBasePath;
Page pageAnnotation;
Secured securedAnnotation;
Class<?> currentClass = viewDefinitionClass;
while (currentClass != null && !Object.class.getName().equals(currentClass.getName()))
{
//security
if (currentClass.isAnnotationPresent(Secured.class))
{
securedAnnotation = currentClass.getAnnotation(Secured.class);
scannedViewConfig.addAccessDecisionVoters(securedAnnotation.value());
if (scannedViewConfig.getErrorView() == null &&
!DefaultErrorView.class.getName().equals(securedAnnotation.errorView().getName()))
{
scannedViewConfig.setErrorView(securedAnnotation.errorView());
}
}
//meta-data
scannedViewConfig.addMetaData(
extractViewMetaData(currentClass, scannedViewConfig));
//page definition
if (currentClass.isAnnotationPresent(Page.class))
{
pageAnnotation = currentClass.getAnnotation(Page.class);
if (!pageAnnotation.extension().equals(defaultExtension))
{
scannedViewConfig.setExtension(pageAnnotation.extension());
}
if (!pageAnnotation.basePath().equals(rootPath))
{
currentBasePath = pageAnnotation.basePath();
if (!".".equals(currentBasePath))
{
scannedViewConfig
.setSimpleClassNameToPathMapping(currentClass.getSimpleName(), currentBasePath);
}
else if (rootPath.equals(scannedViewConfig.getBasePath()))
{
scannedViewConfig.setBasePath(currentBasePath);
}
}
if (!scannedViewConfig.isKnownNavigationMode() &&
!pageAnnotation.navigation().equals(Page.NavigationMode.DEFAULT))
{
scannedViewConfig.setNavigationMode(pageAnnotation.navigation());
}
if (!scannedViewConfig.isKnownViewParameterMode() &&
!pageAnnotation.viewParams().equals(Page.ViewParameterMode.DEFAULT))
{
scannedViewConfig.setViewParameterMode(pageAnnotation.viewParams());
}
if (!pageAnnotation.name().equals(defaultPageName))
{
scannedViewConfig.setPageName(pageAnnotation.name());
}
}
//scan interfaces
for(Class interfaceClass : currentClass.getInterfaces())