final CompositeIndex index = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPOSITE_ANNOTATION_INDEX);
final EEApplicationClasses applicationClasses = deploymentUnit.getAttachment(Attachments.EE_APPLICATION_CLASSES_DESCRIPTION);
final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
final List<AnnotationInstance> resourceAnnotations = index.getAnnotations(RESOURCE_ANNOTATION_NAME);
for (AnnotationInstance annotation : resourceAnnotations) {
final AnnotationTarget annotationTarget = annotation.target();
final AnnotationValue nameValue = annotation.value("name");
final String name = nameValue != null ? nameValue.asString() : null;
final AnnotationValue typeValue = annotation.value("type");
final String type = typeValue != null ? typeValue.asClass().name().toString() : null;
if (annotationTarget instanceof FieldInfo) {
FieldInfo fieldInfo = (FieldInfo) annotationTarget;
ClassInfo classInfo = fieldInfo.declaringClass();
EEModuleClassDescription classDescription = applicationClasses.getOrAddClassByName(classInfo.name().toString());
processFieldResource(phaseContext, fieldInfo, name, type, classDescription, annotation, eeModuleDescription, module);
} else if (annotationTarget instanceof MethodInfo) {
MethodInfo methodInfo = (MethodInfo) annotationTarget;
ClassInfo classInfo = methodInfo.declaringClass();
EEModuleClassDescription classDescription = applicationClasses.getOrAddClassByName(classInfo.name().toString());
processMethodResource(phaseContext, methodInfo, name, type, classDescription, annotation, eeModuleDescription, module);
} else if (annotationTarget instanceof ClassInfo) {
ClassInfo classInfo = (ClassInfo) annotationTarget;
EEModuleClassDescription classDescription = applicationClasses.getOrAddClassByName(classInfo.name().toString());
processClassResource(phaseContext, name, type, classDescription, annotation, eeModuleDescription, module);
}
}
final List<AnnotationInstance> resourcesAnnotations = index.getAnnotations(RESOURCES_ANNOTATION_NAME);
for (AnnotationInstance outerAnnotation : resourcesAnnotations) {
final AnnotationTarget annotationTarget = outerAnnotation.target();
if (annotationTarget instanceof ClassInfo) {
final ClassInfo classInfo = (ClassInfo) annotationTarget;
final AnnotationInstance[] values = outerAnnotation.value("value").asNestedArray();
for (AnnotationInstance annotation : values) {
final AnnotationValue nameValue = annotation.value("name");