TestContextAnnotationUtils
を推奨 @DeprecatedSE public abstract class MetaAnnotationUtils extends ObjectSE
MetaAnnotationUtils
は、AnnotationUtils
ですでに利用可能な標準サポートを補完するユーティリティメソッドのコレクションです。AnnotationUtils
はアノテーションを取得または検索するためのユーティリティを提供しますが、MetaAnnotationUtils
は、アノテーションが宣言されたルートクラスを直接または間接的に構成されたアノテーションを介して決定するためのサポートを提供することにより、さらに一歩前進します。この追加情報は MetaAnnotationUtils.AnnotationDescriptor
にカプセル化されています。
AnnotationDescriptor
によって提供される追加情報は、さまざまな継承されたアノテーション属性(ContextConfiguration.inheritLocations()
など)のマージとオーバーライドをサポートする @ContextConfiguration
、@TestExecutionListeners
、@ActiveProfiles
などのアノテーションのクラス階層トラバーサルをサポートできるようにするために Spring TestContext フレームワークによって必要とされます。
AnnotationUtils
, MetaAnnotationUtils.AnnotationDescriptor
修飾子と型 | クラスと説明 |
---|---|
static class | MetaAnnotationUtils.AnnotationDescriptor<T extends AnnotationSE> 使用すべきではありません。 |
static class | MetaAnnotationUtils.UntypedAnnotationDescriptor 使用すべきではありません。 実際のアノテーション型を事前に決定できない、いくつかの候補アノテーション型の 1 つの宣言を記述するために使用される MetaAnnotationUtils.AnnotationDescriptor の型なし拡張。 |
コンストラクターと説明 |
---|
MetaAnnotationUtils() 使用すべきではありません。 |
修飾子と型 | メソッドと説明 |
---|---|
static <T extends AnnotationSE> | findAnnotationDescriptor(ClassSE<?> clazz, ClassSE<T> annotationType) 使用すべきではありません。 指定された Class SE で指定された annotationType の MetaAnnotationUtils.AnnotationDescriptor を検索し、指定されたクラス自体にアノテーションが見つからない場合は、そのアノテーション、インターフェース、スーパークラスをトラバースします。 |
static MetaAnnotationUtils.UntypedAnnotationDescriptor | findAnnotationDescriptorForTypes(ClassSE<?> clazz, ClassSE<? extends AnnotationSE>... annotationTypes) 使用すべきではありません。 指定された annotationTypes の少なくとも 1 つを宣言する、指定された clazz (指定された clazz 自体を含む)の継承階層の最初の Class SE の MetaAnnotationUtils.UntypedAnnotationDescriptor を見つけます。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
@Nullable public static <T extends AnnotationSE> MetaAnnotationUtils.AnnotationDescriptor<T> findAnnotationDescriptor(ClassSE<?> clazz, ClassSE<T> annotationType)
Class
SE で指定された annotationType
の MetaAnnotationUtils.AnnotationDescriptor
を検索し、指定されたクラス自体にアノテーションが見つからない場合は、そのアノテーション、インターフェース、スーパークラスをトラバースします。このメソッドは、継承SE として宣言されていないクラスレベルのアノテーションとメタアノテーションを明示的に処理します。
アルゴリズムは次のように動作します。
AnnotationDescriptor
を返します。このコンテキストでは、この用語は再帰的に、現在のアノテーション、インターフェース、スーパークラスをアノテーションを検索するクラスとしてステップ #1 に戻ることによって検索プロセスが続行されることを意味します。
clazz
- アノテーションを探すクラス annotationType
- 検索するアノテーションの型 null
findAnnotationDescriptorForTypes(Class, Class...)
@Nullable public static MetaAnnotationUtils.UntypedAnnotationDescriptor findAnnotationDescriptorForTypes(ClassSE<?> clazz, ClassSE<? extends AnnotationSE>... annotationTypes)
annotationTypes
の少なくとも 1 つを宣言する、指定された clazz
(指定された clazz
自体を含む)の継承階層の最初の Class
SE の MetaAnnotationUtils.UntypedAnnotationDescriptor
を見つけます。 このメソッドは、指定されたクラス自体にアノテーションが見つからない場合、指定された clazz
のアノテーション、インターフェース、スーパークラスをトラバースします。
このメソッドは、継承SE として宣言されていないクラスレベルのアノテーションとメタアノテーションを明示的に処理します。
アルゴリズムは次のように動作します。
UntypedAnnotationDescriptor
を返します。このコンテキストでは、この用語は再帰的に、現在のアノテーション、インターフェース、スーパークラスをアノテーションを検索するクラスとしてステップ #1 に戻ることによって検索プロセスが続行されることを意味します。
clazz
- アノテーションを探すクラス annotationTypes
- 探すアノテーションの種類 null
findAnnotationDescriptor(Class, Class)