try { if (info instanceof ClassInfo) { classes.add(((ClassInfo) info).get()); try { String superType = classInfo.getSuperType(); for (Class clazz : classes) { if (superType.equals(clazz.getName())) { classes.add(classInfo.get()); tempClassInfos.remove(pos); annClassFound = true; List<String> interfces = classInfo.getInterfaces(); for (String interfce : interfces) { for (Class clazz : classes) { if (interfce.replaceFirst("<.*>", "").equals(clazz.getName())) { classes.add(classInfo.get()); tempClassInfos.remove(pos); annClassFound = true; classesNotLoaded.add(classInfo.getName()); } catch (NoClassDefFoundError e) { classesNotLoaded.add(classInfo.getName());
/** * This method is called for classes from bean archives with * bean-discovery-mode 'annotated'. * * This method is intended to be overwritten in integration scenarios and e.g. * allows to add other criterias for keeping the class. * * @param classInfo * @return true if this class should be kept and further get picked up as CDI Bean */ protected boolean isBeanAnnotatedClass(AnnotationFinder.ClassInfo classInfo) { // check whether this class has 'scope' annotations or a stereotype for (AnnotationFinder.AnnotationInfo annotationInfo : classInfo.getAnnotations()) { if (Interceptor.class.getName().equals(annotationInfo.getName()) || Decorator.class.getName().equals(annotationInfo.getName()) || isBeanAnnotation(annotationInfo)) { return true; } } return false; }
@Override public String getMetaAnnotationName() { for (AnnotationInfo info : getAnnotations()) { for (Class<? extends Annotation> metaroot : metaroots) { if (info.getName().equals(metaroot.getName())) return name; } } if (name.endsWith("$$")) { ClassInfo info = classInfos.get(name.substring(0, name.length() - 2)); if (info != null) { return info.getMetaAnnotationName(); } } return null; }
ClassInfo classInfo = new ClassInfo(clazz); infos.add(classInfo); for (Method method : clazz.getDeclaredMethods()) {
for (int i = classInfo.getMethods().size() - 1; i >= 0; i--) { final MethodInfo atI = classInfo.getMethods().get(i); if (atI.getName().equals(name) && StringUtils.equals(atI.getDescriptor(), desc)) { testMethodInfo = atI;
try { if (info instanceof ClassInfo) { classes.add(((ClassInfo) info).get()); try { String superType = classInfo.getSuperType(); for (Class clazz : classes) { if (superType.equals(clazz.getName())) { classes.add(classInfo.get()); tempClassInfos.remove(pos); annClassFound = true; List<String> interfces = classInfo.getInterfaces(); for (String interfce : interfces) { for (Class clazz : classes) { if (interfce.replaceFirst("<.*>", "").equals(clazz.getName())) { classes.add(classInfo.get()); tempClassInfos.remove(pos); annClassFound = true; classesNotLoaded.add(classInfo.getName()); } catch (NoClassDefFoundError e) { classesNotLoaded.add(classInfo.getName());
try { if (info instanceof ClassInfo) { classes.add(((ClassInfo) info).get()); try { String superType = classInfo.getSuperType(); for (Class clazz : classes) { if (superType.equals(clazz.getName())) { classes.add(classInfo.get()); tempClassInfos.remove(pos); annClassFound = true; List<String> interfces = classInfo.getInterfaces(); for (String interfce : interfces) { for (Class clazz : classes) { if (interfce.replaceFirst("<.*>", "").equals(clazz.getName())) { classes.add(classInfo.get()); tempClassInfos.remove(pos); annClassFound = true; classesNotLoaded.add(classInfo.getName()); } catch (NoClassDefFoundError e) { classesNotLoaded.add(classInfo.getName());
ClassInfo classInfo = new ClassInfo(clazz); infos.add(classInfo); for (Method method : clazz.getDeclaredMethods()) {
Class clazz = classInfo.get(); for (Method method : clazz.getDeclaredMethods()) { if (method.isAnnotationPresent(annotation)) { classesNotLoaded.add(classInfo.getName()); } catch (ClassCircularityError cce) { classesNotLoaded.add(classInfo.getName()); methods.add(method); } catch (ClassNotFoundException e) { classesNotLoaded.add(methodInfo.getDeclaringClass().getName());
Class clazz = classInfo.get(); for (Field field : clazz.getDeclaredFields()) { if (field.isAnnotationPresent(annotation)) { classesNotLoaded.add(classInfo.getName()); } catch (NoClassDefFoundError ncdfe) { classesNotLoaded.add(classInfo.getName()); fields.add((Field) fieldInfo.get()); } catch (ClassNotFoundException e) { classesNotLoaded.add(fieldInfo.getDeclaringClass().getName());
Class clazz = classInfo.get(); for (Constructor constructor : clazz.getConstructors()) { if (constructor.isAnnotationPresent(annotation)) { classesNotLoaded.add(classInfo.getName()); } catch (NoClassDefFoundError ncdfe) { classesNotLoaded.add(classInfo.getName()); constructors.add((Constructor) methodInfo.get()); } catch (ClassNotFoundException e) { classesNotLoaded.add(methodInfo.getDeclaringClass().getName());
Class<?> clazz = classInfo.get(); for (Method method : clazz.getDeclaredMethods()) { for (Annotation[] annotations : method.getParameterAnnotations()) { classesNotLoaded.add(classInfo.getName()); result.add(parameter); } catch (ClassNotFoundException e) { classesNotLoaded.add(parameterInfo.getDeclaringMethod().getDeclaringClass().getName());
Class clazz = classInfo.get(); for (Field field : clazz.getDeclaredFields()) { if (field.isAnnotationPresent(annotation)) { classesNotLoaded.add(classInfo.getName()); } catch (NoClassDefFoundError ncdfe) { classesNotLoaded.add(classInfo.getName()); fields.add((Field) fieldInfo.get()); } catch (ClassNotFoundException e) { classesNotLoaded.add(fieldInfo.getDeclaringClass().getName());
clazz = metaInfo.get(); } catch (ClassNotFoundException e) { classesNotLoaded.add(metaInfo.getName()); continue; Class clazz = classInfo.get(); for (Method method : clazz.getDeclaredMethods()) { if (method.isAnnotationPresent(annotation)) { classesNotLoaded.add(classInfo.getName()); } catch (NoClassDefFoundError ncdfe) { classesNotLoaded.add(classInfo.getName());
ClassInfo classInfo = new ClassInfo(clazz); infos.add(classInfo); classInfos.put(clazz.getName(), classInfo);
private Member toMethod() throws ClassNotFoundException { org.objectweb.asm.commons.Method method = new org.objectweb.asm.commons.Method(name, descriptor); Class<?> clazz = this.declaringClass.get(); List<Class> parameterTypes = new LinkedList<Class>(); for (Type type : method.getArgumentTypes()) { String paramType = type.getClassName(); try { parameterTypes.add(Classes.forName(paramType, clazz.getClassLoader())); } catch (ClassNotFoundException cnfe) { throw new IllegalStateException("Parameter class could not be loaded for type " + paramType, cnfe); } } Class[] parameters = parameterTypes.toArray(new Class[parameterTypes.size()]); IllegalStateException noSuchMethod = null; while (clazz != null) { try { if (name.equals("<init>")) { return clazz.getDeclaredConstructor(parameters); } else { return clazz.getDeclaredMethod(name, parameters); } } catch (NoSuchMethodException e) { if (noSuchMethod == null) { noSuchMethod = new IllegalStateException("Callback method does not exist: " + clazz.getName() + "." + name, e); } clazz = clazz.getSuperclass(); } } throw noSuchMethod; }