Minor polishing of related files

Issue: SPR-10181
This commit is contained in:
Juergen Hoeller
2013-08-21 17:37:06 +02:00
parent 6d3649858e
commit f2fb0ec9e7
4 changed files with 14 additions and 19 deletions

View File

@@ -419,8 +419,8 @@ public abstract class AnnotationUtils {
Annotation[] realAnnotations = (Annotation[]) value;
AnnotationAttributes[] mappedAnnotations = new AnnotationAttributes[realAnnotations.length];
for (int i = 0; i < realAnnotations.length; i++) {
mappedAnnotations[i] = getAnnotationAttributes(realAnnotations[i], classValuesAsString,
nestedAnnotationsAsMap);
mappedAnnotations[i] = getAnnotationAttributes(
realAnnotations[i], classValuesAsString, nestedAnnotationsAsMap);
}
attrs.put(method.getName(), mappedAnnotations);
}

View File

@@ -75,9 +75,9 @@ public interface AnnotatedTypeMetadata {
* Retrieve all attributes of all annotations of the given type, if any (i.e. if
* defined on the underlying method, as direct annotation or as meta-annotation).
* @param annotationType the annotation type to look for
* @return a MultiMap of attributes, with the attribute name as key (e.g. "value") and
* a list of the defined attribute values as Map value. This return value will
* be {@code null} if no matching annotation is defined.
* @return a MultiMap of attributes, with the attribute name as key (e.g. "value")
* and a list of the defined attribute values as Map value. This return value will
* be {@code null} if no matching annotation is defined.
*/
MultiValueMap<String, Object> getAllAnnotationAttributes(String annotationType);
@@ -86,12 +86,11 @@ public interface AnnotatedTypeMetadata {
* defined on the underlying method, as direct annotation or as meta-annotation).
* @param annotationType the annotation type to look for
* @param classValuesAsString whether to convert class references to String
* @return a MultiMap of attributes, with the attribute name as key (e.g. "value") and
* a list of the defined attribute values as Map value. This return value will
* be {@code null} if no matching annotation is defined.
* @return a MultiMap of attributes, with the attribute name as key (e.g. "value")
* and a list of the defined attribute values as Map value. This return value will
* be {@code null} if no matching annotation is defined.
* @see #getAllAnnotationAttributes(String)
*/
MultiValueMap<String, Object> getAllAnnotationAttributes(String annotationType,
boolean classValuesAsString);
MultiValueMap<String, Object> getAllAnnotationAttributes(String annotationType, boolean classValuesAsString);
}

View File

@@ -115,8 +115,7 @@ public class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisito
public AnnotationAttributes getAnnotationAttributes(String annotationType, boolean classValuesAsString) {
List<AnnotationAttributes> attributes = this.attributeMap.get(annotationType);
AnnotationAttributes raw = (attributes == null ? null : attributes.get(0));
return AnnotationReadingVisitorUtils.convertClassValues(this.classLoader, raw,
classValuesAsString);
return AnnotationReadingVisitorUtils.convertClassValues(this.classLoader, raw, classValuesAsString);
}
@Override
@@ -125,16 +124,15 @@ public class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisito
}
@Override
public MultiValueMap<String, Object> getAllAnnotationAttributes(
String annotationType, boolean classValuesAsString) {
public MultiValueMap<String, Object> getAllAnnotationAttributes(String annotationType, boolean classValuesAsString) {
MultiValueMap<String, Object> allAttributes = new LinkedMultiValueMap<String, Object>();
List<AnnotationAttributes> attributes = this.attributeMap.get(annotationType);
if (attributes == null) {
return null;
}
for (AnnotationAttributes raw : attributes) {
for (Map.Entry<String, Object> entry : AnnotationReadingVisitorUtils.convertClassValues(
this.classLoader, raw, classValuesAsString).entrySet()) {
for (Map.Entry<String, Object> entry :
AnnotationReadingVisitorUtils.convertClassValues(this.classLoader, raw, classValuesAsString).entrySet()) {
allAttributes.add(entry.getKey(), entry.getValue());
}
}