Skip to content

Commit 807828b

Browse files
committed
Polish Javadoc for MergedAnnotation support
See gh-21697
1 parent a4279c5 commit 807828b

19 files changed

+233
-221
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ private <T> T getRequiredAttributeValue(String attributeName, Class<T> type) {
199199
* Get the underlying attribute value.
200200
* @param attributeName the attribute name
201201
* @param type the type to return (see {@link MergedAnnotation} class
202-
* documentation for details).
202+
* documentation for details)
203203
* @return the attribute value or {@code null} if the value is not found and
204204
* is not required
205205
* @throws IllegalArgumentException if the source type is not compatible

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public interface AnnotationFilter {
3535

3636
/**
3737
* {@link AnnotationFilter} that matches annotations in the
38-
* {@code java.*}/{@code javax.*} namespaces.
38+
* {@code java.*} and {@code javax.*} namespaces.
3939
*/
4040
AnnotationFilter JAVA = packages("java", "javax");
4141

@@ -75,14 +75,14 @@ default boolean matches(Class<?> type) {
7575

7676
/**
7777
* Test if the given type name matches the filter.
78-
* @param typeName the annotation type to test
78+
* @param typeName the fully qualified class name of the annotation type to test
7979
* @return {@code true} if the annotation matches
8080
*/
8181
boolean matches(String typeName);
8282

8383

8484
/**
85-
* Return a new {@link AnnotationFilter} that matches annotations in the
85+
* Create a new {@link AnnotationFilter} that matches annotations in the
8686
* specified packages.
8787
* @param packages the annotation packages that should match
8888
* @return a new {@link AnnotationFilter} instance

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
* the context of a root annotation type.
4343
*
4444
* @author Phillip Webb
45+
* @author Sam Brannen
4546
* @since 5.2
4647
* @see AnnotationTypeMappings
4748
*/
@@ -339,15 +340,15 @@ private void validateMirrorSet(MirrorSet mirrorSet) {
339340
}
340341

341342
/**
342-
* Return the root mapping.
343+
* Get the root mapping.
343344
* @return the root mapping
344345
*/
345346
AnnotationTypeMapping getRoot() {
346347
return this.root;
347348
}
348349

349350
/**
350-
* Return the parent mapping or {@code null}.
351+
* Get the parent mapping or {@code null}.
351352
* @return the parent mapping
352353
*/
353354
@Nullable
@@ -356,23 +357,23 @@ AnnotationTypeMapping getParent() {
356357
}
357358

358359
/**
359-
* Return the depth of this mapping.
360+
* Get the depth of this mapping.
360361
* @return the depth of the mapping
361362
*/
362363
int getDepth() {
363364
return this.depth;
364365
}
365366

366367
/**
367-
* Return the type of the mapped annotation.
368+
* Get the type of the mapped annotation.
368369
* @return the annotation type
369370
*/
370371
Class<? extends Annotation> getAnnotationType() {
371372
return this.annotationType;
372373
}
373374

374375
/**
375-
* Return the source annotation for this mapping. This will be the
376+
* Get the source annotation for this mapping. This will be the
376377
* meta-annotation, or {@code null} if this is the root mapping.
377378
* @return the source annotation of the mapping
378379
*/
@@ -382,15 +383,15 @@ Annotation getAnnotation() {
382383
}
383384

384385
/**
385-
* Return the annotation attributes for the mapping annotation type.
386+
* Get the annotation attributes for the mapping annotation type.
386387
* @return the attribute methods
387388
*/
388389
AttributeMethods getAttributes() {
389390
return this.attributes;
390391
}
391392

392393
/**
393-
* Return the related index of an alias mapped attribute, or {@code -1} if
394+
* Get the related index of an alias mapped attribute, or {@code -1} if
394395
* there is no mapping. The resulting value is the index of the attribute on
395396
* the root annotation that can be invoked in order to obtain the actual
396397
* value.
@@ -402,7 +403,7 @@ int getAliasMapping(int attributeIndex) {
402403
}
403404

404405
/**
405-
* Return the related index of a convention mapped attribute, or {@code -1}
406+
* Get the related index of a convention mapped attribute, or {@code -1}
406407
* if there is no mapping. The resulting value is the index of the attribute
407408
* on the root annotation that can be invoked in order to obtain the actual
408409
* value.
@@ -414,7 +415,7 @@ int getConventionMapping(int attributeIndex) {
414415
}
415416

416417
/**
417-
* Return a mapped attribute value from the most suitable
418+
* Get a mapped attribute value from the most suitable
418419
* {@link #getAnnotation() meta-annotation}. The resulting value is obtained
419420
* from the closest meta-annotation, taking into consideration both
420421
* convention and alias based mapping rules. For root mappings, this method
@@ -433,7 +434,7 @@ Object getMappedAnnotationValue(int attributeIndex) {
433434
}
434435

435436
/**
436-
* Return if the specified value is equivalent to the default value of the
437+
* Determine if the specified value is equivalent to the default value of the
437438
* attribute at the given index.
438439
* @param attributeIndex the attribute index of the source attribute
439440
* @param value the value to check
@@ -449,7 +450,7 @@ boolean isEquivalentToDefaultValue(int attributeIndex, Object value,
449450
}
450451

451452
/**
452-
* Return the mirror sets for this type mapping.
453+
* Get the mirror sets for this type mapping.
453454
* @return the mirrorSets the attribute mirror sets.
454455
*/
455456
MirrorSets getMirrorSets() {

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* root {@link Annotation}.
3434
*
3535
* <p>Supports convention based merging of meta-annotations as well as implicit
36-
* and explicit {@link AliasFor @AliasFor} aliases. Also provide information
36+
* and explicit {@link AliasFor @AliasFor} aliases. Also provides information
3737
* about mirrored attributes.
3838
*
3939
* <p>This class is designed to be cached so that meta-annotations only need to
@@ -136,17 +136,17 @@ private boolean isAlreadyMapped(AnnotationTypeMapping parent, Annotation metaAnn
136136
}
137137

138138
/**
139-
* Return the total number of contained mappings.
139+
* Get the total number of contained mappings.
140140
* @return the total number of mappings
141141
*/
142142
int size() {
143143
return this.mappings.size();
144144
}
145145

146146
/**
147-
* Return an individual mapping from this instance. Index {@code 0} will
148-
* always be return the root mapping, higer indexes will return
149-
* meta-annotation mappings.
147+
* Get an individual mapping from this instance.
148+
* <p>Index {@code 0} will always return the root mapping; higher indexes
149+
* will return meta-annotation mappings.
150150
* @param index the index to return
151151
* @return the {@link AnnotationTypeMapping}
152152
* @throws IndexOutOfBoundsException if the index is out of range
@@ -158,7 +158,7 @@ AnnotationTypeMapping get(int index) {
158158

159159

160160
/**
161-
* Return {@link AnnotationTypeMappings} for the specified annotation type.
161+
* Create {@link AnnotationTypeMappings} for the specified annotation type.
162162
* @param annotationType the source annotation type
163163
* @return type mappings for the annotation type
164164
*/
@@ -167,7 +167,7 @@ static AnnotationTypeMappings forAnnotationType(Class<? extends Annotation> anno
167167
}
168168

169169
/**
170-
* Return {@link AnnotationTypeMappings} for the specified annotation type.
170+
* Create {@link AnnotationTypeMappings} for the specified annotation type.
171171
* @param annotationType the source annotation type
172172
* @param annotationFilter the annotation filter used to limit which
173173
* annotations are considered

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ default R doWithAggregate(C context, int aggregateIndex) {
5858
R doWithAnnotations(C context, int aggregateIndex, @Nullable Object source, Annotation[] annotations);
5959

6060
/**
61-
* Return the final result to be returned. By default this method returns
61+
* Get the final result to be returned. By default this method returns
6262
* the last process result.
6363
* @param result the last early exit result, or {@code null} if none
6464
* @return the final result to be returned to the caller

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import org.springframework.util.ReflectionUtils;
3636

3737
/**
38-
* Scanner to search for relevant annotations on the hierarchy of an
38+
* Scanner to search for relevant annotations in the annotation hierarchy of an
3939
* {@link AnnotatedElement}.
4040
*
4141
* @author Phillip Webb

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private AttributeMethods(@Nullable Class<? extends Annotation> annotationType, M
8989

9090

9191
/**
92-
* Return if this instance only contains only a single attribute named
92+
* Determine if this instance only contains only a single attribute named
9393
* {@code value}.
9494
* @return {@code true} if this is only a value attribute
9595
*/
@@ -100,9 +100,8 @@ boolean isOnlyValueAttribute() {
100100

101101

102102
/**
103-
* Returns {@code true} if values from the given annotation can be safely
104-
* accessed without causing any {@link TypeNotPresentException
105-
* TypeNotPresentExceptions}.
103+
* Determine if values from the given annotation can be safely accessed without
104+
* causing any {@link TypeNotPresentException TypeNotPresentExceptions}.
106105
* @param annotation the annotation to check
107106
* @return {@code true} if all values are present
108107
* @see #validate(Annotation)
@@ -123,7 +122,7 @@ boolean isValid(Annotation annotation) {
123122
}
124123

125124
/**
126-
* Checks if values from the given annotation can be safely accessed without causing
125+
* Check if values from the given annotation can be safely accessed without causing
127126
* any {@link TypeNotPresentException TypeNotPresentExceptions}. In particular,
128127
* this method is designed to cover Google App Engine's late arrival of such
129128
* exceptions for {@code Class} values (instead of the more typical early
@@ -155,7 +154,7 @@ private void assertAnnotation(Annotation annotation) {
155154
}
156155

157156
/**
158-
* Return the attribute with the specified name or {@code null} if no
157+
* Get the attribute with the specified name or {@code null} if no
159158
* matching attribute exists.
160159
* @param name the attribute name to find
161160
* @return the attribute method or {@code null}
@@ -167,7 +166,7 @@ Method get(String name) {
167166
}
168167

169168
/**
170-
* Return the attribute at the specified index.
169+
* Get the attribute at the specified index.
171170
* @param index the index of the attribute to return
172171
* @return the attribute method
173172
* @throws IndexOutOfBoundsException if the index is out of range
@@ -178,7 +177,7 @@ Method get(int index) {
178177
}
179178

180179
/**
181-
* Return {@code true} if the attribute at the specified index could throw a
180+
* Determine if the attribute at the specified index could throw a
182181
* {@link TypeNotPresentException} when accessed.
183182
* @param index the index of the attribute to check
184183
* @return {@code true} if the attribute can throw a
@@ -189,7 +188,7 @@ boolean canThrowTypeNotPresentException(int index) {
189188
}
190189

191190
/**
192-
* Return the index of the attribute with the specified name, or {@code -1}
191+
* Get the index of the attribute with the specified name, or {@code -1}
193192
* if there is no attribute with the name.
194193
* @param name the name to find
195194
* @return the index of the attribute, or {@code -1}
@@ -204,8 +203,8 @@ int indexOf(String name) {
204203
}
205204

206205
/**
207-
* Return the index of the specified attribute , or {@code -1} if the
208-
* attribute is not not in this collection.
206+
* Get the index of the specified attribute, or {@code -1} if the
207+
* attribute is not in this collection.
209208
* @param attribute the attribute to find
210209
* @return the index of the attribute, or {@code -1}
211210
*/
@@ -219,34 +218,35 @@ int indexOf(Method attribute) {
219218
}
220219

221220
/**
222-
* Return the number of attributes in this collection.
221+
* Get the number of attributes in this collection.
223222
* @return the number of attributes
224223
*/
225224
int size() {
226225
return this.attributeMethods.length;
227226
}
228227

229228
/**
230-
* Return if at least one of the attribute methods has a default value.
231-
* @return if there is at least one attribute method with a default value
229+
* Determine if at least one of the attribute methods has a default value.
230+
* @return {@code true} if there is at least one attribute method with a default value
232231
*/
233232
boolean hasDefaultValueMethod() {
234233
return this.hasDefaultValueMethod;
235234
}
236235

237236
/**
238-
* Return if at least on of the attribute methods is a nested annotation.
239-
* @return if there is at least one attribute method with a annotation type
237+
* Determine if at least one of the attribute methods is a nested annotation.
238+
* @return {@code true} if there is at least one attribute method with a nested
239+
* annotation type
240240
*/
241241
boolean hasNestedAnnotation() {
242242
return this.hasNestedAnnotation;
243243
}
244244

245245

246246
/**
247-
* Return the attribute methods for the given annotation type.
247+
* Get the attribute methods for the given annotation type.
248248
* @param annotationType the annotation type
249-
* @return the attribute methods for the annotation
249+
* @return the attribute methods for the annotation type
250250
*/
251251
static AttributeMethods forAnnotationType(@Nullable Class<? extends Annotation> annotationType) {
252252
if (annotationType == null) {
@@ -278,7 +278,7 @@ private static boolean isAttributeMethod(Method method) {
278278
}
279279

280280
/**
281-
* Return a description for the given attribute method suitable to use in
281+
* Create a description for the given attribute method suitable to use in
282282
* exception messages and logs.
283283
* @param attribute the attribute to describe
284284
* @return a description of the attribute
@@ -291,7 +291,7 @@ static String describe(@Nullable Method attribute) {
291291
}
292292

293293
/**
294-
* Return a description for the given attribute method suitable to use in
294+
* Create a description for the given attribute method suitable to use in
295295
* exception messages and logs.
296296
* @param annotationType the annotation type
297297
* @param attributeName the attribute name

0 commit comments

Comments
 (0)