Skip to content

Commit f2fb0ec

Browse files
committed
Minor polishing of related files
Issue: SPR-10181
1 parent 6d36498 commit f2fb0ec

File tree

4 files changed

+14
-19
lines changed

4 files changed

+14
-19
lines changed

spring-context/src/main/java/org/springframework/context/annotation/AnnotationScopeMetadataResolver.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
import org.springframework.core.annotation.AnnotationAttributes;
2424
import org.springframework.util.Assert;
2525

26-
import static org.springframework.context.annotation.MetadataUtils.*;
27-
2826
/**
2927
* A {@link ScopeMetadataResolver} implementation that by default checks for
3028
* the presence of Spring's {@link Scope} annotation on the bean class.
@@ -79,7 +77,7 @@ public ScopeMetadata resolveScopeMetadata(BeanDefinition definition) {
7977
ScopeMetadata metadata = new ScopeMetadata();
8078
if (definition instanceof AnnotatedBeanDefinition) {
8179
AnnotatedBeanDefinition annDef = (AnnotatedBeanDefinition) definition;
82-
AnnotationAttributes attributes = attributesFor(annDef.getMetadata(), this.scopeAnnotationType);
80+
AnnotationAttributes attributes = MetadataUtils.attributesFor(annDef.getMetadata(), this.scopeAnnotationType);
8381
if (attributes != null) {
8482
metadata.setScopeName(attributes.getString("value"));
8583
ScopedProxyMode proxyMode = attributes.getEnum("proxyMode");

spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,8 @@ else if (nestedAnnotationsAsMap && value instanceof Annotation[]) {
419419
Annotation[] realAnnotations = (Annotation[]) value;
420420
AnnotationAttributes[] mappedAnnotations = new AnnotationAttributes[realAnnotations.length];
421421
for (int i = 0; i < realAnnotations.length; i++) {
422-
mappedAnnotations[i] = getAnnotationAttributes(realAnnotations[i], classValuesAsString,
423-
nestedAnnotationsAsMap);
422+
mappedAnnotations[i] = getAnnotationAttributes(
423+
realAnnotations[i], classValuesAsString, nestedAnnotationsAsMap);
424424
}
425425
attrs.put(method.getName(), mappedAnnotations);
426426
}

spring-core/src/main/java/org/springframework/core/type/AnnotatedTypeMetadata.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ public interface AnnotatedTypeMetadata {
7575
* Retrieve all attributes of all annotations of the given type, if any (i.e. if
7676
* defined on the underlying method, as direct annotation or as meta-annotation).
7777
* @param annotationType the annotation type to look for
78-
* @return a MultiMap of attributes, with the attribute name as key (e.g. "value") and
79-
* a list of the defined attribute values as Map value. This return value will
80-
* be {@code null} if no matching annotation is defined.
78+
* @return a MultiMap of attributes, with the attribute name as key (e.g. "value")
79+
* and a list of the defined attribute values as Map value. This return value will
80+
* be {@code null} if no matching annotation is defined.
8181
*/
8282
MultiValueMap<String, Object> getAllAnnotationAttributes(String annotationType);
8383

@@ -86,12 +86,11 @@ public interface AnnotatedTypeMetadata {
8686
* defined on the underlying method, as direct annotation or as meta-annotation).
8787
* @param annotationType the annotation type to look for
8888
* @param classValuesAsString whether to convert class references to String
89-
* @return a MultiMap of attributes, with the attribute name as key (e.g. "value") and
90-
* a list of the defined attribute values as Map value. This return value will
91-
* be {@code null} if no matching annotation is defined.
89+
* @return a MultiMap of attributes, with the attribute name as key (e.g. "value")
90+
* and a list of the defined attribute values as Map value. This return value will
91+
* be {@code null} if no matching annotation is defined.
9292
* @see #getAllAnnotationAttributes(String)
9393
*/
94-
MultiValueMap<String, Object> getAllAnnotationAttributes(String annotationType,
95-
boolean classValuesAsString);
94+
MultiValueMap<String, Object> getAllAnnotationAttributes(String annotationType, boolean classValuesAsString);
9695

9796
}

spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationMetadataReadingVisitor.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ public AnnotationAttributes getAnnotationAttributes(String annotationType) {
115115
public AnnotationAttributes getAnnotationAttributes(String annotationType, boolean classValuesAsString) {
116116
List<AnnotationAttributes> attributes = this.attributeMap.get(annotationType);
117117
AnnotationAttributes raw = (attributes == null ? null : attributes.get(0));
118-
return AnnotationReadingVisitorUtils.convertClassValues(this.classLoader, raw,
119-
classValuesAsString);
118+
return AnnotationReadingVisitorUtils.convertClassValues(this.classLoader, raw, classValuesAsString);
120119
}
121120

122121
@Override
@@ -125,16 +124,15 @@ public MultiValueMap<String, Object> getAllAnnotationAttributes(String annotatio
125124
}
126125

127126
@Override
128-
public MultiValueMap<String, Object> getAllAnnotationAttributes(
129-
String annotationType, boolean classValuesAsString) {
127+
public MultiValueMap<String, Object> getAllAnnotationAttributes(String annotationType, boolean classValuesAsString) {
130128
MultiValueMap<String, Object> allAttributes = new LinkedMultiValueMap<String, Object>();
131129
List<AnnotationAttributes> attributes = this.attributeMap.get(annotationType);
132130
if (attributes == null) {
133131
return null;
134132
}
135133
for (AnnotationAttributes raw : attributes) {
136-
for (Map.Entry<String, Object> entry : AnnotationReadingVisitorUtils.convertClassValues(
137-
this.classLoader, raw, classValuesAsString).entrySet()) {
134+
for (Map.Entry<String, Object> entry :
135+
AnnotationReadingVisitorUtils.convertClassValues(this.classLoader, raw, classValuesAsString).entrySet()) {
138136
allAttributes.add(entry.getKey(), entry.getValue());
139137
}
140138
}

0 commit comments

Comments
 (0)