private Member resolveMember() { ClassLoader loader = this.clazz.getClassLoader(); Class<?>[] argTypes = new Class<?>[this.args.length]; for (int i = 0; i < this.args.length; i++) { argTypes[i] = ClassUtils.resolveClassName(this.args[i].getClassName(), loader); } try { if (CONSTRUCTOR.equals(this.name)) { return this.clazz.getDeclaredConstructor(argTypes); } return this.clazz.getDeclaredMethod(this.name, argTypes); } catch (NoSuchMethodException ex) { throw new IllegalStateException("Method [" + this.name + "] was discovered in the .class file but cannot be resolved in the class object", ex); } }
protected Object getEnumValue(String asmTypeDescriptor, String attributeValue) { Object valueToUse = attributeValue; try { Class<?> enumType = ClassUtils.forName(Type.getType(asmTypeDescriptor).getClassName(), this.classLoader); Field enumConstant = ReflectionUtils.findField(enumType, attributeValue); if (enumConstant != null) { ReflectionUtils.makeAccessible(enumConstant); valueToUse = enumConstant.get(null); } } catch (ClassNotFoundException | NoClassDefFoundError ex) { logger.debug("Failed to classload enum type while reading annotation metadata", ex); } catch (IllegalAccessException | AccessControlException ex) { logger.debug("Could not access enum value while reading annotation metadata", ex); } return valueToUse; }
@Override public AnnotationVisitor visitAnnotation(String desc, boolean visible) { String className = Type.getType(desc).getClassName(); this.annotationSet.add(className); return new AnnotationAttributesReadingVisitor( className, this.attributesMap, this.metaAnnotationMap, this.classLoader); }
@Override public AnnotationVisitor visitAnnotation(final String desc, boolean visible) { this.methodMetadataSet.add(this); String className = Type.getType(desc).getClassName(); return new AnnotationAttributesReadingVisitor( className, this.attributesMap, this.metaAnnotationMap, this.classLoader); }
@Override public AnnotationVisitor visitAnnotation(String attributeName, String asmTypeDescriptor) { String annotationType = Type.getType(asmTypeDescriptor).getClassName(); AnnotationAttributes nestedAttributes = new AnnotationAttributes(annotationType, this.classLoader); this.allNestedAttributes.add(nestedAttributes); return new RecursiveAnnotationAttributesVisitor(annotationType, nestedAttributes, this.classLoader); }
private Member resolveMember() { ClassLoader loader = this.clazz.getClassLoader(); Class<?>[] argTypes = new Class<?>[this.args.length]; for (int i = 0; i < this.args.length; i++) { argTypes[i] = ClassUtils.resolveClassName(this.args[i].getClassName(), loader); } try { if (CONSTRUCTOR.equals(this.name)) { return this.clazz.getDeclaredConstructor(argTypes); } return this.clazz.getDeclaredMethod(this.name, argTypes); } catch (NoSuchMethodException ex) { throw new IllegalStateException("Method [" + this.name + "] was discovered in the .class file but cannot be resolved in the class object", ex); } }
protected Object getEnumValue(String asmTypeDescriptor, String attributeValue) { Object valueToUse = attributeValue; try { Class<?> enumType = ClassUtils.forName(Type.getType(asmTypeDescriptor).getClassName(), this.classLoader); Field enumConstant = ReflectionUtils.findField(enumType, attributeValue); if (enumConstant != null) { ReflectionUtils.makeAccessible(enumConstant); valueToUse = enumConstant.get(null); } } catch (ClassNotFoundException | NoClassDefFoundError ex) { logger.debug("Failed to classload enum type while reading annotation metadata", ex); } catch (IllegalAccessException | AccessControlException ex) { logger.debug("Could not access enum value while reading annotation metadata", ex); } return valueToUse; }
return "double"; case ARRAY: StringBuilder stringBuilder = new StringBuilder(getElementType().getClassName()); for (int i = getDimensions(); i > 0; --i) { stringBuilder.append("[]");
value = (classValuesAsString ? ((Type) value).getClassName() : ClassUtils.forName(((Type) value).getClassName(), classLoader)); (classValuesAsString ? new String[array.length] : new Class<?>[array.length]); for (int i = 0; i < array.length; i++) { convArray[i] = (classValuesAsString ? array[i].getClassName() : ClassUtils.forName(array[i].getClassName(), classLoader));
@Override public AnnotationVisitor visitAnnotation(final String desc, boolean visible) { this.methodMetadataSet.add(this); String className = Type.getType(desc).getClassName(); return new AnnotationAttributesReadingVisitor( className, this.attributesMap, this.metaAnnotationMap, this.classLoader); }
@Override public AnnotationVisitor visitAnnotation(String desc, boolean visible) { String className = Type.getType(desc).getClassName(); this.annotationSet.add(className); return new AnnotationAttributesReadingVisitor( className, this.attributesMap, this.metaAnnotationMap, this.classLoader); }
@Override public AnnotationVisitor visitAnnotation(String attributeName, String asmTypeDescriptor) { String annotationType = Type.getType(asmTypeDescriptor).getClassName(); AnnotationAttributes nestedAttributes = new AnnotationAttributes(annotationType, this.classLoader); this.allNestedAttributes.add(nestedAttributes); return new RecursiveAnnotationAttributesVisitor(annotationType, nestedAttributes, this.classLoader); }
return "double"; case ARRAY: StringBuilder stringBuilder = new StringBuilder(getElementType().getClassName()); for (int i = getDimensions(); i > 0; --i) { stringBuilder.append("[]");
@Override public AnnotationVisitor visitAnnotation(String attributeName, String asmTypeDescriptor) { String annotationType = Type.getType(asmTypeDescriptor).getClassName(); AnnotationAttributes nestedAttributes = new AnnotationAttributes(annotationType, this.classLoader); this.attributes.put(attributeName, nestedAttributes); return new RecursiveAnnotationAttributesVisitor(annotationType, nestedAttributes, this.classLoader); }
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { // Skip bridge methods - we're only interested in original annotation-defining user methods. // On JDK 8, we'd otherwise run into double detection of the same annotated method... if ((access & Opcodes.ACC_BRIDGE) != 0) { return super.visitMethod(access, name, desc, signature, exceptions); } return new MethodMetadataReadingVisitor(name, access, getClassName(), Type.getReturnType(desc).getClassName(), this.classLoader, this.methodMetadataSet); }
value = (classValuesAsString ? ((Type) value).getClassName() : ClassUtils.forName(((Type) value).getClassName(), classLoader)); (classValuesAsString ? new String[array.length] : new Class<?>[array.length]); for (int i = 0; i < array.length; i++) { convArray[i] = (classValuesAsString ? array[i].getClassName() : ClassUtils.forName(array[i].getClassName(), classLoader));
@Override public AnnotationVisitor visitAnnotation(String attributeName, String asmTypeDescriptor) { String annotationType = Type.getType(asmTypeDescriptor).getClassName(); AnnotationAttributes nestedAttributes = new AnnotationAttributes(annotationType, this.classLoader); this.attributes.put(attributeName, nestedAttributes); return new RecursiveAnnotationAttributesVisitor(annotationType, nestedAttributes, this.classLoader); }
@Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { // Skip bridge methods - we're only interested in original annotation-defining user methods. // On JDK 8, we'd otherwise run into double detection of the same annotated method... if ((access & Opcodes.ACC_BRIDGE) != 0) { return super.visitMethod(access, name, desc, signature, exceptions); } return new MethodMetadataReadingVisitor(name, access, getClassName(), Type.getReturnType(desc).getClassName(), this.classLoader, this.methodMetadataSet); }
@Override public AnnotationVisitor visitAnnotation(final String desc, boolean visible) { String className = Type.getType(desc).getClassName(); this.annotationSet.add(className); return new AnnotationAttributesReadingVisitor(className, this.attributeMap, this.metaAnnotationMap, this.classLoader); }
public AnnotationVisitor visitAnnotation(String attributeName, String asmTypeDescriptor) { String annotationType = Type.getType(asmTypeDescriptor).getClassName(); AnnotationAttributes nestedAttributes = new AnnotationAttributes(); this.attributes.put(attributeName, nestedAttributes); return new RecursiveAnnotationAttributesVisitor(annotationType, nestedAttributes, this.classLoader); }