@Override protected AnnotationAttributeExtractor<?> createExtractorFor(Class<?> clazz, String expected, Class<? extends Annotation> annotationType) { return new DefaultAnnotationAttributeExtractor(clazz.getAnnotation(annotationType), clazz); }
@Override @Nullable protected Object getRawAttributeValue(String attributeName) { Method attributeMethod = ReflectionUtils.findMethod(getAnnotationType(), attributeName); return (attributeMethod != null ? getRawAttributeValue(attributeMethod) : null); }
@Override @Nullable protected Object getRawAttributeValue(Method attributeMethod) { ReflectionUtils.makeAccessible(attributeMethod); return ReflectionUtils.invokeMethod(attributeMethod, getSource()); }
@Override @Nullable protected Object getRawAttributeValue(String attributeName) { Method attributeMethod = ReflectionUtils.findMethod(getAnnotationType(), attributeName); return (attributeMethod != null ? getRawAttributeValue(attributeMethod) : null); }
@SuppressWarnings("unchecked") static <A extends Annotation> A synthesizeAnnotation(A annotation, @Nullable Object annotatedElement) { if (annotation instanceof SynthesizedAnnotation || hasPlainJavaAnnotationsOnly(annotatedElement)) { return annotation; } Class<? extends Annotation> annotationType = annotation.annotationType(); if (!isSynthesizable(annotationType)) { return annotation; } DefaultAnnotationAttributeExtractor attributeExtractor = new DefaultAnnotationAttributeExtractor(annotation, annotatedElement); InvocationHandler handler = new SynthesizedAnnotationInvocationHandler(attributeExtractor); // Can always expose Spring's SynthesizedAnnotation marker since we explicitly check for a // synthesizable annotation before (which needs to declare @AliasFor from the same package) Class<?>[] exposedInterfaces = new Class<?>[] {annotationType, SynthesizedAnnotation.class}; return (A) Proxy.newProxyInstance(annotation.getClass().getClassLoader(), exposedInterfaces, handler); }
@Override @Nullable protected Object getRawAttributeValue(Method attributeMethod) { ReflectionUtils.makeAccessible(attributeMethod); return ReflectionUtils.invokeMethod(attributeMethod, getSource()); }
@Override @Nullable protected Object getRawAttributeValue(String attributeName) { Method attributeMethod = ReflectionUtils.findMethod(getAnnotationType(), attributeName); return (attributeMethod != null ? getRawAttributeValue(attributeMethod) : null); }
@SuppressWarnings("unchecked") static <A extends Annotation> A synthesizeAnnotation(A annotation, @Nullable Object annotatedElement) { if (annotation instanceof SynthesizedAnnotation || hasPlainJavaAnnotationsOnly(annotatedElement)) { return annotation; } Class<? extends Annotation> annotationType = annotation.annotationType(); if (!isSynthesizable(annotationType)) { return annotation; } DefaultAnnotationAttributeExtractor attributeExtractor = new DefaultAnnotationAttributeExtractor(annotation, annotatedElement); InvocationHandler handler = new SynthesizedAnnotationInvocationHandler(attributeExtractor); // Can always expose Spring's SynthesizedAnnotation marker since we explicitly check for a // synthesizable annotation before (which needs to declare @AliasFor from the same package) Class<?>[] exposedInterfaces = new Class<?>[] {annotationType, SynthesizedAnnotation.class}; return (A) Proxy.newProxyInstance(annotation.getClass().getClassLoader(), exposedInterfaces, handler); }
@Override @Nullable protected Object getRawAttributeValue(Method attributeMethod) { ReflectionUtils.makeAccessible(attributeMethod); return ReflectionUtils.invokeMethod(attributeMethod, getSource()); }
@Override @Nullable protected Object getRawAttributeValue(String attributeName) { Method attributeMethod = ReflectionUtils.findMethod(getAnnotationType(), attributeName); return (attributeMethod != null ? getRawAttributeValue(attributeMethod) : null); }
@SuppressWarnings("unchecked") static <A extends Annotation> A synthesizeAnnotation(A annotation, @Nullable Object annotatedElement) { if (annotation instanceof SynthesizedAnnotation || hasPlainJavaAnnotationsOnly(annotatedElement)) { return annotation; } Class<? extends Annotation> annotationType = annotation.annotationType(); if (!isSynthesizable(annotationType)) { return annotation; } DefaultAnnotationAttributeExtractor attributeExtractor = new DefaultAnnotationAttributeExtractor(annotation, annotatedElement); InvocationHandler handler = new SynthesizedAnnotationInvocationHandler(attributeExtractor); // Can always expose Spring's SynthesizedAnnotation marker since we explicitly check for a // synthesizable annotation before (which needs to declare @AliasFor from the same package) Class<?>[] exposedInterfaces = new Class<?>[] {annotationType, SynthesizedAnnotation.class}; return (A) Proxy.newProxyInstance(annotation.getClass().getClassLoader(), exposedInterfaces, handler); }
@Override @Nullable protected Object getRawAttributeValue(Method attributeMethod) { ReflectionUtils.makeAccessible(attributeMethod); return ReflectionUtils.invokeMethod(attributeMethod, getSource()); }
@Override @Nullable protected Object getRawAttributeValue(String attributeName) { Method attributeMethod = ReflectionUtils.findMethod(getAnnotationType(), attributeName); return (attributeMethod != null ? getRawAttributeValue(attributeMethod) : null); }
@SuppressWarnings("unchecked") static <A extends Annotation> A synthesizeAnnotation(A annotation, @Nullable Object annotatedElement) { if (annotation instanceof SynthesizedAnnotation) { return annotation; } Class<? extends Annotation> annotationType = annotation.annotationType(); if (!isSynthesizable(annotationType)) { return annotation; } DefaultAnnotationAttributeExtractor attributeExtractor = new DefaultAnnotationAttributeExtractor(annotation, annotatedElement); InvocationHandler handler = new SynthesizedAnnotationInvocationHandler(attributeExtractor); // Can always expose Spring's SynthesizedAnnotation marker since we explicitly check for a // synthesizable annotation before (which needs to declare @AliasFor from the same package) Class<?>[] exposedInterfaces = new Class<?>[] {annotationType, SynthesizedAnnotation.class}; return (A) Proxy.newProxyInstance(annotation.getClass().getClassLoader(), exposedInterfaces, handler); }
@Override @Nullable protected Object getRawAttributeValue(Method attributeMethod) { ReflectionUtils.makeAccessible(attributeMethod); return ReflectionUtils.invokeMethod(attributeMethod, getSource()); }
@SuppressWarnings("unchecked") static <A extends Annotation> A synthesizeAnnotation(A annotation, @Nullable Object annotatedElement) { if (annotation instanceof SynthesizedAnnotation || hasPlainJavaAnnotationsOnly(annotatedElement)) { return annotation; } Class<? extends Annotation> annotationType = annotation.annotationType(); if (!isSynthesizable(annotationType)) { return annotation; } DefaultAnnotationAttributeExtractor attributeExtractor = new DefaultAnnotationAttributeExtractor(annotation, annotatedElement); InvocationHandler handler = new SynthesizedAnnotationInvocationHandler(attributeExtractor); // Can always expose Spring's SynthesizedAnnotation marker since we explicitly check for a // synthesizable annotation before (which needs to declare @AliasFor from the same package) Class<?>[] exposedInterfaces = new Class<?>[] {annotationType, SynthesizedAnnotation.class}; return (A) Proxy.newProxyInstance(annotation.getClass().getClassLoader(), exposedInterfaces, handler); }