From 744350a262fa0d0e1dcf2e9106859ac8dfece0a3 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sat, 19 Mar 2016 18:28:05 +0100 Subject: [PATCH] Polishing --- .../core/annotation/AnnotatedElementUtils.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java b/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java index a001ff2e78..6f3038cbce 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java @@ -1079,12 +1079,10 @@ public class AnnotatedElementUtils { } } - private void overrideAttributes(AnnotatedElement element, Annotation annotation, AnnotationAttributes attributes, - String sourceAttributeName, List targetAttributeNames) { + private void overrideAttributes(AnnotatedElement element, Annotation annotation, + AnnotationAttributes attributes, String sourceAttributeName, List targetAttributeNames) { - Object value = AnnotationUtils.getValue(annotation, sourceAttributeName); - Object adaptedValue = AnnotationUtils.adaptValue(element, value, this.classValuesAsString, - this.nestedAnnotationsAsMap); + Object adaptedValue = getAdaptedValue(element, annotation, sourceAttributeName); for (String targetAttributeName : targetAttributeNames) { attributes.put(targetAttributeName, adaptedValue); @@ -1094,10 +1092,12 @@ public class AnnotatedElementUtils { private void overrideAttribute(AnnotatedElement element, Annotation annotation, AnnotationAttributes attributes, String sourceAttributeName, String targetAttributeName) { + attributes.put(targetAttributeName, getAdaptedValue(element, annotation, sourceAttributeName)); + } + + private Object getAdaptedValue(AnnotatedElement element, Annotation annotation, String sourceAttributeName) { Object value = AnnotationUtils.getValue(annotation, sourceAttributeName); - Object adaptedValue = AnnotationUtils.adaptValue(element, value, this.classValuesAsString, - this.nestedAnnotationsAsMap); - attributes.put(targetAttributeName, adaptedValue); + return AnnotationUtils.adaptValue(element, value, this.classValuesAsString, this.nestedAnnotationsAsMap); } }