private SessionType determineSessionType(final String ejbClass, final CompositeIndex compositeIndex) { if(ejbClass == null) { return null; } final ClassInfo info = compositeIndex.getClassByName(DotName.createSimple(ejbClass)); if (info == null) { return null; } if(info.annotations().get(STATEFUL_ANNOTATION) != null) { return SessionType.Stateful; } else if(info.annotations().get(STATELESS_ANNOTATION) != null) { return SessionType.Stateless; } else if(info.annotations().get(SINGLETON_ANNOTATION) != null) { return SessionType.Singleton; } return null; }
@Override public Set<String> apply(DotName name) { ClassInfo annotationClassInfo = index.getClassByName(name); ImmutableSet.Builder<String> builder = ImmutableSet.builder(); if (annotationClassInfo != null) { for (DotName annotationName : annotationClassInfo.annotations().keySet()) { builder.add(annotationName.toString()); } } else { try { Class<?> annotationClass = moduleClassLoader.loadClass(name.toString()); for (Annotation annotation : annotationClass.getDeclaredAnnotations()) { builder.add(annotation.annotationType().getName()); } } catch (ClassNotFoundException e) { WeldLogger.DEPLOYMENT_LOGGER.unableToLoadAnnotation(name.toString()); } } return builder.build(); } }
private String getMessageListenerInterface(final CompositeIndex compositeIndex, final AnnotationInstance messageBeanAnnotation) throws DeploymentUnitProcessingException { final AnnotationValue value = messageBeanAnnotation.value("messageListenerInterface"); if (value != null) return value.asClass().name().toString(); final ClassInfo beanClass = (ClassInfo) messageBeanAnnotation.target(); final Set<DotName> interfaces = new HashSet<DotName>(getPotentialViewInterfaces(beanClass)); // check super class(es) of the bean DotName superClassDotName = beanClass.superName(); while (interfaces.isEmpty() && superClassDotName != null && !superClassDotName.toString().equals(Object.class.getName())) { final ClassInfo superClass = compositeIndex.getClassByName(superClassDotName); if (superClass == null) { break; } interfaces.addAll(getPotentialViewInterfaces(superClass)); // move to next super class superClassDotName = superClass.superName(); } if (interfaces.size() != 1) throw EjbLogger.ROOT_LOGGER.mdbDoesNotImplementNorSpecifyMessageListener(beanClass); return interfaces.iterator().next().toString(); }
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; }
/** * * @param className * @param index * @param annotationClassAnnotationsCache */ public WeldClassFileInfo(String className, CompositeIndex index, ComputingCache<DotName, Set<String>> annotationClassAnnotationsCache, ClassLoader classLoader) { this.index = index; this.annotationClassAnnotationsCache = annotationClassAnnotationsCache; this.classInfo = index.getClassByName(DotName.createSimple(className)); if (this.classInfo == null) { throw WeldLogger.ROOT_LOGGER.nameNotFoundInIndex(className); } this.isVetoed = isVetoedTypeOrPackage(); this.hasCdiConstructor = this.classInfo.hasNoArgsConstructor() || hasInjectConstructor(); this.classLoader = classLoader; }
private boolean containsAnnotation(ClassInfo classInfo, DotName requiredAnnotationName, Class<? extends Annotation> requiredAnnotation) { // Type and members if (classInfo.annotations().containsKey(requiredAnnotationName)) { return true; } // Meta-annotations for (DotName annotation : classInfo.annotations().keySet()) { if (annotationClassAnnotationsCache.getValue(annotation).contains(requiredAnnotationName.toString())) { return true; } } // Superclass final DotName superName = classInfo.superName(); if (superName != null && !OBJECT_NAME.equals(superName)) { final ClassInfo superClassInfo = index.getClassByName(superName); if (superClassInfo == null) { // we are accessing a class that is outside of the jandex index // fallback to using reflection return Reflections.containsAnnotation(loadClass(superName.toString()), requiredAnnotation); } if (containsAnnotation(superClassInfo, requiredAnnotationName, requiredAnnotation)) { return true; } } return false; }
ClassInfo fromClassInfo = index.getClassByName(name); if (fromClassInfo == null) {
if (compositeIndex.getClassByName(DotName.createSimple(clazz)) == null) { boolean found = false; for (String pack : BUILTIN_TAGLIBS) {
public static boolean isJaxwsService(final ClassInfo current, final CompositeIndex 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; }
public static boolean isJaxwsService(final ClassInfo current, final CompositeIndex 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; }
public static boolean isJaxwsService(final ClassInfo current, final CompositeIndex 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; }
private SessionType determineSessionType(final String ejbClass, final CompositeIndex compositeIndex) { if(ejbClass == null) { return null; } final ClassInfo info = compositeIndex.getClassByName(DotName.createSimple(ejbClass)); if (info == null) { return null; } if(info.annotations().get(STATEFUL_ANNOTATION) != null) { return SessionType.Stateful; } else if(info.annotations().get(STATELESS_ANNOTATION) != null) { return SessionType.Stateless; } else if(info.annotations().get(SINGLETON_ANNOTATION) != null) { return SessionType.Singleton; } return null; }
private String getMessageListenerInterface(final CompositeIndex compositeIndex, final AnnotationInstance messageBeanAnnotation) throws DeploymentUnitProcessingException { final AnnotationValue value = messageBeanAnnotation.value("messageListenerInterface"); if (value != null) return value.asClass().name().toString(); final ClassInfo beanClass = (ClassInfo) messageBeanAnnotation.target(); final Set<DotName> interfaces = new HashSet<DotName>(getPotentialViewInterfaces(beanClass)); // check super class(es) of the bean DotName superClassDotName = beanClass.superName(); while (interfaces.isEmpty() && superClassDotName != null && !superClassDotName.toString().equals(Object.class.getName())) { final ClassInfo superClass = compositeIndex.getClassByName(superClassDotName); if (superClass == null) { break; } interfaces.addAll(getPotentialViewInterfaces(superClass)); // move to next super class superClassDotName = superClass.superName(); } if (interfaces.size() != 1) throw MESSAGES.mdbDoesNotImplementNorSpecifyMessageListener(beanClass); return interfaces.iterator().next().toString(); }
if (compositeIndex.getClassByName(DotName.createSimple(clazz)) == null) { boolean found = false; for (String pack : BUILTIN_TAGLIBS) {
if (compositeIndex.getClassByName(DotName.createSimple(clazz)) == null) { boolean found = false; for (String pack : BUILTIN_TAGLIBS) {