use of org.jboss.jandex.ClassInfo in project wildfly by wildfly.
the class ServletContainerInitializerDeploymentProcessor method loadClassInfoSet.
private Set<Class<?>> loadClassInfoSet(Set<ClassInfo> classInfos, ClassLoader classLoader) throws DeploymentUnitProcessingException {
Set<Class<?>> classes = new HashSet<Class<?>>();
for (ClassInfo classInfo : classInfos) {
Class<?> type;
try {
type = classLoader.loadClass(classInfo.name().toString());
classes.add(type);
} catch (Exception e) {
UndertowLogger.ROOT_LOGGER.cannotLoadDesignatedHandleTypes(classInfo, e);
}
}
return classes;
}
use of org.jboss.jandex.ClassInfo in project wildfly by wildfly.
the class ServletContainerInitializerDeploymentProcessor method processHandlesType.
private Set<ClassInfo> processHandlesType(DotName typeName, Class<?> type, CompositeIndex index) throws DeploymentUnitProcessingException {
Set<ClassInfo> classes = new HashSet<ClassInfo>();
if (type.isAnnotation()) {
List<AnnotationInstance> instances = index.getAnnotations(typeName);
for (AnnotationInstance instance : instances) {
AnnotationTarget annotationTarget = instance.target();
if (annotationTarget instanceof ClassInfo) {
classes.add((ClassInfo) annotationTarget);
} else if (annotationTarget instanceof FieldInfo) {
classes.add(((FieldInfo) annotationTarget).declaringClass());
} else if (annotationTarget instanceof MethodInfo) {
classes.add(((MethodInfo) annotationTarget).declaringClass());
} else if (annotationTarget instanceof MethodParameterInfo) {
classes.add(((MethodParameterInfo) annotationTarget).method().declaringClass());
}
}
} else {
classes.addAll(index.getAllKnownSubclasses(typeName));
classes.addAll(index.getAllKnownImplementors(typeName));
}
return classes;
}
use of org.jboss.jandex.ClassInfo in project wildfly by wildfly.
the class WSRefAnnotationProcessor method deploy.
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit unit = phaseContext.getDeploymentUnit();
// Process @WebServiceRef annotations
final List<AnnotationInstance> webServiceRefAnnotations = getAnnotations(unit, WEB_SERVICE_REF_ANNOTATION);
for (final AnnotationInstance annotation : webServiceRefAnnotations) {
final AnnotationTarget annotationTarget = annotation.target();
final WSRefAnnotationWrapper annotationWrapper = new WSRefAnnotationWrapper(annotation);
if (annotationTarget instanceof FieldInfo) {
processFieldRef(unit, annotationWrapper, (FieldInfo) annotationTarget);
} else if (annotationTarget instanceof MethodInfo) {
processMethodRef(unit, annotationWrapper, (MethodInfo) annotationTarget);
} else if (annotationTarget instanceof ClassInfo) {
processClassRef(unit, annotationWrapper, (ClassInfo) annotationTarget);
}
}
// Process @WebServiceRefs annotations
final List<AnnotationInstance> webServiceRefsAnnotations = getAnnotations(unit, WEB_SERVICE_REFS_ANNOTATION);
for (final AnnotationInstance outerAnnotation : webServiceRefsAnnotations) {
final AnnotationTarget annotationTarget = outerAnnotation.target();
if (annotationTarget instanceof ClassInfo) {
final AnnotationInstance[] values = outerAnnotation.value("value").asNestedArray();
for (final AnnotationInstance annotation : values) {
final WSRefAnnotationWrapper annotationWrapper = new WSRefAnnotationWrapper(annotation);
processClassRef(unit, annotationWrapper, (ClassInfo) annotationTarget);
}
}
}
}
use of org.jboss.jandex.ClassInfo in project wildfly by wildfly.
the class ASHelper method isJaxwsService.
public static boolean isJaxwsService(final ClassInfo current, final Index index) {
ClassInfo tmp = current;
while (tmp != null) {
final DotName superName = tmp.superName();
if (JAXWS_SERVICE_CLASS.equals(superName)) {
return true;
}
tmp = index.getClassByName(superName);
}
return false;
}
use of org.jboss.jandex.ClassInfo in project wildfly by wildfly.
the class AroundInvokeAnnotationParsingProcessor method processAroundInvoke.
private void processAroundInvoke(final EEModuleDescription eeModuleDescription, final AnnotationTarget target) throws DeploymentUnitProcessingException {
if (!(target instanceof MethodInfo)) {
throw EeLogger.ROOT_LOGGER.methodOnlyAnnotation(AROUND_INVOKE_ANNOTATION_NAME);
}
final MethodInfo methodInfo = MethodInfo.class.cast(target);
final ClassInfo classInfo = methodInfo.declaringClass();
final EEModuleClassDescription classDescription = eeModuleDescription.addOrGetLocalClassDescription(classInfo.name().toString());
final List<AnnotationInstance> classAroundInvokes = classInfo.annotations().get(AROUND_INVOKE_ANNOTATION_NAME);
if (classAroundInvokes.size() > 1) {
throw EeLogger.ROOT_LOGGER.aroundInvokeAnnotationUsedTooManyTimes(classInfo.name(), classAroundInvokes.size());
}
validateArgumentType(classInfo, methodInfo);
InterceptorClassDescription.Builder builder = InterceptorClassDescription.builder(classDescription.getInterceptorClassDescription());
builder.setAroundInvoke(MethodIdentifier.getIdentifier(Object.class, methodInfo.name(), InvocationContext.class));
classDescription.setInterceptorClassDescription(builder.build());
}
Aggregations