use of org.jboss.jandex.ClassInfo in project wildfly by wildfly.
the class ASHelper method isJaxwsEndpoint.
public static boolean isJaxwsEndpoint(final EEModuleClassDescription classDescription, final CompositeIndex index) {
ClassInfo classInfo = null;
WebServiceAnnotationInfo webserviceAnnoationInfo = null;
final ClassAnnotationInformation<WebService, WebServiceAnnotationInfo> classAnnotationInfo = classDescription.getAnnotationInformation(WebService.class);
if (classAnnotationInfo != null && !classAnnotationInfo.getClassLevelAnnotations().isEmpty()) {
webserviceAnnoationInfo = classAnnotationInfo.getClassLevelAnnotations().get(0);
classInfo = (ClassInfo) webserviceAnnoationInfo.getTarget();
}
WebServiceProviderAnnotationInfo webserviceProviderAnnoationInfo = null;
final ClassAnnotationInformation<WebServiceProvider, WebServiceProviderAnnotationInfo> providerAnnotationInfo = classDescription.getAnnotationInformation(WebServiceProvider.class);
if (providerAnnotationInfo != null && !providerAnnotationInfo.getClassLevelAnnotations().isEmpty()) {
webserviceProviderAnnoationInfo = providerAnnotationInfo.getClassLevelAnnotations().get(0);
classInfo = (ClassInfo) webserviceProviderAnnoationInfo.getTarget();
}
if (classInfo == null) {
return false;
}
// assert JAXWS endpoint class flags
final short flags = classInfo.flags();
if (Modifier.isInterface(flags))
return false;
if (Modifier.isAbstract(flags))
return false;
if (!Modifier.isPublic(flags))
return false;
if (isJaxwsService(classInfo, index))
return false;
if (webserviceAnnoationInfo != null && webserviceProviderAnnoationInfo != null) {
WSLogger.ROOT_LOGGER.mutuallyExclusiveAnnotations(classInfo.name().toString());
return false;
}
if (Modifier.isFinal(flags)) {
WSLogger.ROOT_LOGGER.finalEndpointClassDetected(classInfo.name().toString());
return false;
}
return true;
}
use of org.jboss.jandex.ClassInfo in project wildfly by wildfly.
the class WeldClassFileInfo method isAssignableTo.
/**
* @param to
* @param name
* @return <code>true</code> if the name is equal to the fromName, or if the name represents a superclass or superinterface of the fromName,
* <code>false</code> otherwise
*/
private boolean isAssignableTo(DotName name, Class<?> to) {
if (to.getName().equals(name.toString())) {
return true;
}
if (OBJECT_NAME.equals(name)) {
// there's nothing assignable from Object.class except for Object.class
return false;
}
ClassInfo fromClassInfo = index.getClassByName(name);
if (fromClassInfo == null) {
// We reached a class that is not in the index. Let's use reflection.
final Class<?> clazz = loadClass(name.toString());
return to.isAssignableFrom(clazz);
}
DotName superName = fromClassInfo.superName();
if (superName != null && isAssignableTo(superName, to)) {
return true;
}
if (fromClassInfo.interfaces() != null) {
for (DotName interfaceName : fromClassInfo.interfaces()) {
if (isAssignableTo(interfaceName, to)) {
return true;
}
}
}
return false;
}
use of org.jboss.jandex.ClassInfo in project wildfly by wildfly.
the class WeldClassFileInfo method isVetoedTypeOrPackage.
private boolean isVetoedTypeOrPackage() {
if (isAnnotationDeclared(classInfo, DOT_NAME_VETOED)) {
return true;
}
final DotName packageInfoName = DotName.createComponentized(getPackageName(classInfo.name()), PACKAGE_INFO_NAME);
ClassInfo packageInfo = index.getClassByName(packageInfoName);
if (packageInfo != null && isAnnotationDeclared(packageInfo, DOT_NAME_VETOED)) {
return true;
}
return false;
}
use of org.jboss.jandex.ClassInfo in project wildfly by wildfly.
the class XTSHandlerDeploymentProcessor method addEndpointsToList.
private void addEndpointsToList(Set<String> endpoints, List<AnnotationInstance> annotations) {
for (AnnotationInstance annotationInstance : annotations) {
Object target = annotationInstance.target();
if (target instanceof ClassInfo) {
final ClassInfo classInfo = (ClassInfo) annotationInstance.target();
final String endpointClass = classInfo.name().toString();
endpoints.add(endpointClass);
} else if (target instanceof MethodInfo) {
final MethodInfo methodInfo = (MethodInfo) target;
final String endpointClass = methodInfo.declaringClass().name().toString();
endpoints.add(endpointClass);
}
}
}
use of org.jboss.jandex.ClassInfo in project wildfly by wildfly.
the class XTSDependenciesDeploymentProcessor method isTransactionalEndpointPresent.
private boolean isTransactionalEndpointPresent(final CompositeIndex compositeIndex) {
final List<AnnotationInstance> annotations = new ArrayList<>();
annotations.addAll(compositeIndex.getAnnotations(DotName.createSimple(Transactional.class.getName())));
annotations.addAll(compositeIndex.getAnnotations(DotName.createSimple(TransactionAttribute.class.getName())));
for (final AnnotationInstance annotation : annotations) {
final Object target = annotation.target();
if (target instanceof ClassInfo) {
final ClassInfo classInfo = (ClassInfo) target;
if (classInfo.annotations().get(DotName.createSimple(WebService.class.getName())) != null) {
return true;
}
}
}
return false;
}
Aggregations