Skip to content

Commit d0c839f

Browse files
committed
Polishing
1 parent 744727b commit d0c839f

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

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

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,8 @@ public static <A extends Annotation> A findAnnotation(Class<?> clazz, Class<A> a
275275
* @param visited the set of annotations that have already been visited
276276
* @return the annotation if found, or {@code null} if not found
277277
*/
278-
private static <A extends Annotation> A findAnnotation(Class<?> clazz, Class<A> annotationType,
279-
Set<Annotation> visited) {
278+
private static <A extends Annotation> A findAnnotation(Class<?> clazz, Class<A> annotationType, Set<Annotation> visited) {
280279
Assert.notNull(clazz, "Class must not be null");
281-
282280
if (isAnnotationDeclaredLocally(annotationType, clazz)) {
283281
return clazz.getAnnotation(annotationType);
284282
}
@@ -424,10 +422,9 @@ public static boolean isAnnotationInherited(Class<? extends Annotation> annotati
424422
}
425423

426424
/**
427-
* Determine if the supplied {@link Annotation} is defined in the
425+
* Determine if the supplied {@link Annotation} is defined in the core JDK
428426
* {@code java.lang.annotation} package.
429-
*
430-
* @param annotation the annotation to check; never {@code null}
427+
* @param annotation the annotation to check (never {@code null})
431428
* @return {@code true} if the annotation is in the {@code java.lang.annotation} package
432429
*/
433430
public static boolean isInJavaLangAnnotationPackage(Annotation annotation) {
@@ -436,11 +433,10 @@ public static boolean isInJavaLangAnnotationPackage(Annotation annotation) {
436433
}
437434

438435
/**
439-
* Retrieve the given annotation's attributes as a Map, preserving all attribute types
440-
* as-is.
441-
* <p>Note: As of Spring 3.1.1, the returned map is actually an
442-
* {@link AnnotationAttributes} instance, however the Map signature of this method has
443-
* been preserved for binary compatibility.
436+
* Retrieve the given annotation's attributes as a {@link Map}, preserving all
437+
* attribute types as-is.
438+
* <p>Note: This method actually returns an {@link AnnotationAttributes} instance.
439+
* However, the {@code Map} signature has been preserved for binary compatibility.
444440
* @param annotation the annotation to retrieve the attributes for
445441
* @return the Map of annotation attributes, with attribute names as keys and
446442
* corresponding attribute values as values
@@ -450,16 +446,15 @@ public static Map<String, Object> getAnnotationAttributes(Annotation annotation)
450446
}
451447

452448
/**
453-
* Retrieve the given annotation's attributes as a Map. Equivalent to calling
454-
* {@link #getAnnotationAttributes(Annotation, boolean, boolean)} with
449+
* Retrieve the given annotation's attributes as a {@link Map}. Equivalent to
450+
* calling {@link #getAnnotationAttributes(Annotation, boolean, boolean)} with
455451
* the {@code nestedAnnotationsAsMap} parameter set to {@code false}.
456-
* <p>Note: As of Spring 3.1.1, the returned map is actually an
457-
* {@link AnnotationAttributes} instance, however the Map signature of this method has
458-
* been preserved for binary compatibility.
452+
* <p>Note: This method actually returns an {@link AnnotationAttributes} instance.
453+
* However, the {@code Map} signature has been preserved for binary compatibility.
459454
* @param annotation the annotation to retrieve the attributes for
460455
* @param classValuesAsString whether to turn Class references into Strings (for
461-
* compatibility with {@link org.springframework.core.type.AnnotationMetadata} or to
462-
* preserve them as Class references
456+
* compatibility with {@link org.springframework.core.type.AnnotationMetadata}
457+
* or to preserve them as Class references
463458
* @return the Map of annotation attributes, with attribute names as keys and
464459
* corresponding attribute values as values
465460
*/
@@ -469,13 +464,13 @@ public static Map<String, Object> getAnnotationAttributes(Annotation annotation,
469464

470465
/**
471466
* Retrieve the given annotation's attributes as an {@link AnnotationAttributes}
472-
* map structure. Implemented in Spring 3.1.1 to provide fully recursive annotation
473-
* reading capabilities on par with that of the reflection-based
474-
* {@link org.springframework.core.type.StandardAnnotationMetadata}.
467+
* map structure.
468+
* <p>This method provides fully recursive annotation reading capabilities on par with
469+
* the reflection-based {@link org.springframework.core.type.StandardAnnotationMetadata}.
475470
* @param annotation the annotation to retrieve the attributes for
476471
* @param classValuesAsString whether to turn Class references into Strings (for
477-
* compatibility with {@link org.springframework.core.type.AnnotationMetadata} or to
478-
* preserve them as Class references
472+
* compatibility with {@link org.springframework.core.type.AnnotationMetadata}
473+
* or to preserve them as Class references
479474
* @param nestedAnnotationsAsMap whether to turn nested Annotation instances into
480475
* {@link AnnotationAttributes} maps (for compatibility with
481476
* {@link org.springframework.core.type.AnnotationMetadata} or to preserve them as
@@ -543,7 +538,7 @@ public static Object getValue(Annotation annotation) {
543538
}
544539

545540
/**
546-
* Retrieve the <em>value</em> of a named Annotation attribute, given an annotation instance.
541+
* Retrieve the <em>value</em> of a named attribute, given an annotation instance.
547542
* @param annotation the annotation instance from which to retrieve the value
548543
* @param attributeName the name of the attribute value to retrieve
549544
* @return the attribute value, or {@code null} if not found
@@ -572,7 +567,7 @@ public static Object getDefaultValue(Annotation annotation) {
572567
}
573568

574569
/**
575-
* Retrieve the <em>default value</em> of a named Annotation attribute, given an annotation instance.
570+
* Retrieve the <em>default value</em> of a named attribute, given an annotation instance.
576571
* @param annotation the annotation instance from which to retrieve the default value
577572
* @param attributeName the name of the attribute value to retrieve
578573
* @return the default value of the named attribute, or {@code null} if not found
@@ -594,7 +589,8 @@ public static Object getDefaultValue(Class<? extends Annotation> annotationType)
594589
}
595590

596591
/**
597-
* Retrieve the <em>default value</em> of a named Annotation attribute, given the {@link Class annotation type}.
592+
* Retrieve the <em>default value</em> of a named attribute, given the
593+
* {@link Class annotation type}.
598594
* @param annotationType the <em>annotation type</em> for which the default value should be retrieved
599595
* @param attributeName the name of the attribute value to retrieve.
600596
* @return the default value of the named attribute, or {@code null} if not found

0 commit comments

Comments
 (0)