Merge branch '6.2.x'
This commit is contained in:
commit
fe41cd6d20
|
@ -37,8 +37,12 @@ import org.springframework.util.MultiValueMap;
|
||||||
*
|
*
|
||||||
* <p>{@code AnnotatedElementUtils} defines the public API for Spring's
|
* <p>{@code AnnotatedElementUtils} defines the public API for Spring's
|
||||||
* meta-annotation programming model with support for <em>annotation attribute
|
* meta-annotation programming model with support for <em>annotation attribute
|
||||||
* overrides</em>. If you do not need support for annotation attribute
|
* overrides</em> and {@link AliasFor @AliasFor}. Note, however, that
|
||||||
* overrides, consider using {@link AnnotationUtils} instead.
|
* {@code AnnotatedElementUtils} is effectively a facade for the
|
||||||
|
* {@link MergedAnnotations} API. For fine-grained support consider using the
|
||||||
|
* {@code MergedAnnotations} API directly. If you do not need support for
|
||||||
|
* annotation attribute overrides, {@code @AliasFor}, or merged annotations,
|
||||||
|
* consider using {@link AnnotationUtils} instead.
|
||||||
*
|
*
|
||||||
* <p>Note that the features of this class are not provided by the JDK's
|
* <p>Note that the features of this class are not provided by the JDK's
|
||||||
* introspection facilities themselves.
|
* introspection facilities themselves.
|
||||||
|
@ -88,6 +92,7 @@ import org.springframework.util.MultiValueMap;
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
* @see AliasFor
|
* @see AliasFor
|
||||||
* @see AnnotationAttributes
|
* @see AnnotationAttributes
|
||||||
|
* @see MergedAnnotations
|
||||||
* @see AnnotationUtils
|
* @see AnnotationUtils
|
||||||
* @see BridgeMethodResolver
|
* @see BridgeMethodResolver
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -61,7 +61,7 @@ import org.springframework.util.StringUtils;
|
||||||
* <h3>Terminology</h3>
|
* <h3>Terminology</h3>
|
||||||
* The terms <em>directly present</em>, <em>indirectly present</em>, and
|
* The terms <em>directly present</em>, <em>indirectly present</em>, and
|
||||||
* <em>present</em> have the same meanings as defined in the class-level
|
* <em>present</em> have the same meanings as defined in the class-level
|
||||||
* javadoc for {@link AnnotatedElement} (in Java 8).
|
* javadoc for {@link AnnotatedElement}.
|
||||||
*
|
*
|
||||||
* <p>An annotation is <em>meta-present</em> on an element if the annotation
|
* <p>An annotation is <em>meta-present</em> on an element if the annotation
|
||||||
* is declared as a meta-annotation on some other annotation which is
|
* is declared as a meta-annotation on some other annotation which is
|
||||||
|
@ -74,7 +74,8 @@ import org.springframework.util.StringUtils;
|
||||||
* provide support for finding annotations used as meta-annotations. Consult the
|
* provide support for finding annotations used as meta-annotations. Consult the
|
||||||
* javadoc for each method in this class for details. For fine-grained support for
|
* javadoc for each method in this class for details. For fine-grained support for
|
||||||
* meta-annotations with <em>attribute overrides</em> in <em>composed annotations</em>,
|
* meta-annotations with <em>attribute overrides</em> in <em>composed annotations</em>,
|
||||||
* consider using {@link AnnotatedElementUtils}'s more specific methods instead.
|
* consider using the {@link MergedAnnotations} API directly or the more specific
|
||||||
|
* methods in {@link AnnotatedElementUtils} instead.
|
||||||
*
|
*
|
||||||
* <h3>Attribute Aliases</h3>
|
* <h3>Attribute Aliases</h3>
|
||||||
* <p>All public methods in this class that return annotations, arrays of
|
* <p>All public methods in this class that return annotations, arrays of
|
||||||
|
@ -98,6 +99,7 @@ import org.springframework.util.StringUtils;
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
* @see AliasFor
|
* @see AliasFor
|
||||||
* @see AnnotationAttributes
|
* @see AnnotationAttributes
|
||||||
|
* @see MergedAnnotations
|
||||||
* @see AnnotatedElementUtils
|
* @see AnnotatedElementUtils
|
||||||
* @see BridgeMethodResolver
|
* @see BridgeMethodResolver
|
||||||
* @see java.lang.reflect.AnnotatedElement#getAnnotations()
|
* @see java.lang.reflect.AnnotatedElement#getAnnotations()
|
||||||
|
@ -303,11 +305,11 @@ public abstract class AnnotationUtils {
|
||||||
* {@code annotationType} from the supplied {@link AnnotatedElement}, where
|
* {@code annotationType} from the supplied {@link AnnotatedElement}, where
|
||||||
* such annotations are either <em>present</em>, <em>indirectly present</em>,
|
* such annotations are either <em>present</em>, <em>indirectly present</em>,
|
||||||
* or <em>meta-present</em> on the element.
|
* or <em>meta-present</em> on the element.
|
||||||
* <p>This method mimics the functionality of Java 8's
|
* <p>This method mimics the functionality of
|
||||||
* {@link java.lang.reflect.AnnotatedElement#getAnnotationsByType(Class)}
|
* {@link java.lang.reflect.AnnotatedElement#getAnnotationsByType(Class)}
|
||||||
* with support for automatic detection of a <em>container annotation</em>
|
* with support for automatic detection of a <em>container annotation</em>
|
||||||
* declared via @{@link java.lang.annotation.Repeatable} (when running on
|
* declared via {@link java.lang.annotation.Repeatable @Repeatable} and with
|
||||||
* Java 8 or higher) and with additional support for meta-annotations.
|
* additional support for meta-annotations.
|
||||||
* <p>Handles both single annotations and annotations nested within a
|
* <p>Handles both single annotations and annotations nested within a
|
||||||
* <em>container annotation</em>.
|
* <em>container annotation</em>.
|
||||||
* <p>Correctly handles <em>bridge methods</em> generated by the
|
* <p>Correctly handles <em>bridge methods</em> generated by the
|
||||||
|
@ -338,7 +340,7 @@ public abstract class AnnotationUtils {
|
||||||
* {@code annotationType} from the supplied {@link AnnotatedElement}, where
|
* {@code annotationType} from the supplied {@link AnnotatedElement}, where
|
||||||
* such annotations are either <em>present</em>, <em>indirectly present</em>,
|
* such annotations are either <em>present</em>, <em>indirectly present</em>,
|
||||||
* or <em>meta-present</em> on the element.
|
* or <em>meta-present</em> on the element.
|
||||||
* <p>This method mimics the functionality of Java 8's
|
* <p>This method mimics the functionality
|
||||||
* {@link java.lang.reflect.AnnotatedElement#getAnnotationsByType(Class)}
|
* {@link java.lang.reflect.AnnotatedElement#getAnnotationsByType(Class)}
|
||||||
* with additional support for meta-annotations.
|
* with additional support for meta-annotations.
|
||||||
* <p>Handles both single annotations and annotations nested within a
|
* <p>Handles both single annotations and annotations nested within a
|
||||||
|
@ -349,10 +351,9 @@ public abstract class AnnotationUtils {
|
||||||
* <em>present</em> on the supplied element.
|
* <em>present</em> on the supplied element.
|
||||||
* @param annotatedElement the element to look for annotations on
|
* @param annotatedElement the element to look for annotations on
|
||||||
* @param annotationType the annotation type to look for
|
* @param annotationType the annotation type to look for
|
||||||
* @param containerAnnotationType the type of the container that holds
|
* @param containerAnnotationType the type of the container that holds the
|
||||||
* the annotations; may be {@code null} if a container is not supported
|
* annotations; may be {@code null} if a container is not supported or if it
|
||||||
* or if it should be looked up via @{@link java.lang.annotation.Repeatable}
|
* should be looked up via {@link java.lang.annotation.Repeatable @Repeatable}
|
||||||
* when running on Java 8 or higher
|
|
||||||
* @return the annotations found or an empty set (never {@code null})
|
* @return the annotations found or an empty set (never {@code null})
|
||||||
* @since 4.2
|
* @since 4.2
|
||||||
* @see #getRepeatableAnnotations(AnnotatedElement, Class)
|
* @see #getRepeatableAnnotations(AnnotatedElement, Class)
|
||||||
|
@ -384,11 +385,11 @@ public abstract class AnnotationUtils {
|
||||||
* of {@code annotationType} from the supplied {@link AnnotatedElement},
|
* of {@code annotationType} from the supplied {@link AnnotatedElement},
|
||||||
* where such annotations are either <em>directly present</em>,
|
* where such annotations are either <em>directly present</em>,
|
||||||
* <em>indirectly present</em>, or <em>meta-present</em> on the element.
|
* <em>indirectly present</em>, or <em>meta-present</em> on the element.
|
||||||
* <p>This method mimics the functionality of Java 8's
|
* <p>This method mimics the functionality of
|
||||||
* {@link java.lang.reflect.AnnotatedElement#getDeclaredAnnotationsByType(Class)}
|
* {@link java.lang.reflect.AnnotatedElement#getDeclaredAnnotationsByType(Class)}
|
||||||
* with support for automatic detection of a <em>container annotation</em>
|
* with support for automatic detection of a <em>container annotation</em>
|
||||||
* declared via @{@link java.lang.annotation.Repeatable} (when running on
|
* declared via {@link java.lang.annotation.Repeatable @Repeatable} and with
|
||||||
* Java 8 or higher) and with additional support for meta-annotations.
|
* additional support for meta-annotations.
|
||||||
* <p>Handles both single annotations and annotations nested within a
|
* <p>Handles both single annotations and annotations nested within a
|
||||||
* <em>container annotation</em>.
|
* <em>container annotation</em>.
|
||||||
* <p>Correctly handles <em>bridge methods</em> generated by the
|
* <p>Correctly handles <em>bridge methods</em> generated by the
|
||||||
|
@ -420,7 +421,7 @@ public abstract class AnnotationUtils {
|
||||||
* of {@code annotationType} from the supplied {@link AnnotatedElement},
|
* of {@code annotationType} from the supplied {@link AnnotatedElement},
|
||||||
* where such annotations are either <em>directly present</em>,
|
* where such annotations are either <em>directly present</em>,
|
||||||
* <em>indirectly present</em>, or <em>meta-present</em> on the element.
|
* <em>indirectly present</em>, or <em>meta-present</em> on the element.
|
||||||
* <p>This method mimics the functionality of Java 8's
|
* <p>This method mimics the functionality of
|
||||||
* {@link java.lang.reflect.AnnotatedElement#getDeclaredAnnotationsByType(Class)}
|
* {@link java.lang.reflect.AnnotatedElement#getDeclaredAnnotationsByType(Class)}
|
||||||
* with additional support for meta-annotations.
|
* with additional support for meta-annotations.
|
||||||
* <p>Handles both single annotations and annotations nested within a
|
* <p>Handles both single annotations and annotations nested within a
|
||||||
|
@ -431,10 +432,9 @@ public abstract class AnnotationUtils {
|
||||||
* <em>present</em> on the supplied element.
|
* <em>present</em> on the supplied element.
|
||||||
* @param annotatedElement the element to look for annotations on
|
* @param annotatedElement the element to look for annotations on
|
||||||
* @param annotationType the annotation type to look for
|
* @param annotationType the annotation type to look for
|
||||||
* @param containerAnnotationType the type of the container that holds
|
* @param containerAnnotationType the type of the container that holds the
|
||||||
* the annotations; may be {@code null} if a container is not supported
|
* annotations; may be {@code null} if a container is not supported or if it
|
||||||
* or if it should be looked up via @{@link java.lang.annotation.Repeatable}
|
* should be looked up via {@link java.lang.annotation.Repeatable @Repeatable}
|
||||||
* when running on Java 8 or higher
|
|
||||||
* @return the annotations found or an empty set (never {@code null})
|
* @return the annotations found or an empty set (never {@code null})
|
||||||
* @since 4.2
|
* @since 4.2
|
||||||
* @see #getRepeatableAnnotations(AnnotatedElement, Class)
|
* @see #getRepeatableAnnotations(AnnotatedElement, Class)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -38,7 +38,7 @@ import org.springframework.util.Assert;
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Explicit and Implicit {@link AliasFor @AliasFor} declarations on one or
|
* <li>Explicit and Implicit {@link AliasFor @AliasFor} declarations on one or
|
||||||
* more attributes within the annotation</li>
|
* more attributes within the annotation</li>
|
||||||
* <li>Explicit {@link AliasFor @AliasFor} declarations for a meta-annotation</li>
|
* <li>Explicit {@code @AliasFor} declarations for a meta-annotation</li>
|
||||||
* <li>Convention based attribute aliases for a meta-annotation</li>
|
* <li>Convention based attribute aliases for a meta-annotation</li>
|
||||||
* <li>From a meta-annotation declaration</li>
|
* <li>From a meta-annotation declaration</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
|
@ -141,6 +141,9 @@ import org.springframework.util.Assert;
|
||||||
* @see MergedAnnotationCollectors
|
* @see MergedAnnotationCollectors
|
||||||
* @see MergedAnnotationPredicates
|
* @see MergedAnnotationPredicates
|
||||||
* @see MergedAnnotationSelectors
|
* @see MergedAnnotationSelectors
|
||||||
|
* @see AliasFor
|
||||||
|
* @see AnnotationUtils
|
||||||
|
* @see AnnotatedElementUtils
|
||||||
*/
|
*/
|
||||||
public interface MergedAnnotations extends Iterable<MergedAnnotation<Annotation>> {
|
public interface MergedAnnotations extends Iterable<MergedAnnotation<Annotation>> {
|
||||||
|
|
||||||
|
@ -561,6 +564,7 @@ public interface MergedAnnotations extends Iterable<MergedAnnotation<Annotation>
|
||||||
* @see #withRepeatableContainers(RepeatableContainers)
|
* @see #withRepeatableContainers(RepeatableContainers)
|
||||||
* @see #withAnnotationFilter(AnnotationFilter)
|
* @see #withAnnotationFilter(AnnotationFilter)
|
||||||
* @see #from(AnnotatedElement)
|
* @see #from(AnnotatedElement)
|
||||||
|
* @see org.springframework.test.context.TestContextAnnotationUtils#searchEnclosingClass(Class)
|
||||||
*/
|
*/
|
||||||
public Search withEnclosingClasses(Predicate<Class<?>> searchEnclosingClass) {
|
public Search withEnclosingClasses(Predicate<Class<?>> searchEnclosingClass) {
|
||||||
Assert.notNull(searchEnclosingClass, "Predicate must not be null");
|
Assert.notNull(searchEnclosingClass, "Predicate must not be null");
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2024 the original author or authors.
|
* Copyright 2002-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -44,19 +44,20 @@ import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code TestContextAnnotationUtils} is a collection of utility methods that
|
* {@code TestContextAnnotationUtils} is a collection of utility methods that
|
||||||
* complements the standard support already available in {@link AnnotationUtils}
|
* complements the standard support already available in {@link MergedAnnotations},
|
||||||
* and {@link AnnotatedElementUtils}, while transparently honoring
|
* {@link AnnotationUtils}, and {@link AnnotatedElementUtils}, while transparently
|
||||||
* {@link NestedTestConfiguration @NestedTestConfiguration} semantics.
|
* honoring {@link NestedTestConfiguration @NestedTestConfiguration} semantics.
|
||||||
*
|
*
|
||||||
* <p>Mainly for internal use within the <em>Spring TestContext Framework</em>
|
* <p>Mainly for internal use within the <em>Spring TestContext Framework</em>
|
||||||
* but also supported for third-party integrations with the TestContext framework.
|
* but also supported for third-party integrations with the TestContext framework.
|
||||||
*
|
*
|
||||||
* <p>Whereas {@code AnnotationUtils} and {@code AnnotatedElementUtils} provide
|
* <p>Whereas {@code MergedAnnotations}, {@code AnnotationUtils} and
|
||||||
* utilities for <em>getting</em> or <em>finding</em> annotations,
|
* {@code AnnotatedElementUtils} provide utilities for <em>getting</em> or
|
||||||
* {@code TestContextAnnotationUtils} goes a step further by providing support
|
* <em>finding</em> annotations, {@code TestContextAnnotationUtils} goes a step
|
||||||
* for determining the <em>root class</em> on which an annotation is declared,
|
* further by providing support for determining the <em>root class</em> on which
|
||||||
* either directly or indirectly via a <em>composed annotation</em>. This
|
* an annotation is declared, either directly or indirectly via a
|
||||||
* additional information is encapsulated in an {@link AnnotationDescriptor}.
|
* <em>composed annotation</em>. This additional information is encapsulated in
|
||||||
|
* an {@link AnnotationDescriptor}.
|
||||||
*
|
*
|
||||||
* <p>The additional information provided by an {@code AnnotationDescriptor} is
|
* <p>The additional information provided by an {@code AnnotationDescriptor} is
|
||||||
* required by the <em>Spring TestContext Framework</em> in order to be able to
|
* required by the <em>Spring TestContext Framework</em> in order to be able to
|
||||||
|
@ -68,7 +69,11 @@ import org.springframework.util.ObjectUtils;
|
||||||
* example, {@link ContextConfiguration#inheritLocations}.
|
* example, {@link ContextConfiguration#inheritLocations}.
|
||||||
*
|
*
|
||||||
* @author Sam Brannen
|
* @author Sam Brannen
|
||||||
* @since 5.3, though originally since 4.0 as {@code org.springframework.test.util.MetaAnnotationUtils}
|
* @since 5.3
|
||||||
|
* @see MergedAnnotations
|
||||||
|
* @see MergedAnnotations.Search
|
||||||
|
* @see MergedAnnotations.Search#withEnclosingClasses(Predicate)
|
||||||
|
* @see #searchEnclosingClass(Class)
|
||||||
* @see AnnotationUtils
|
* @see AnnotationUtils
|
||||||
* @see AnnotatedElementUtils
|
* @see AnnotatedElementUtils
|
||||||
* @see AnnotationDescriptor
|
* @see AnnotationDescriptor
|
||||||
|
|
Loading…
Reference in New Issue