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 つの宣言を記述するために使用される AnnotationDescriptor の型なし拡張。 |
| コンストラクターと説明 |
|---|
MetaAnnotationUtils() |
| 修飾子と型 | メソッドと説明 |
|---|---|
static <T extends AnnotationSE> | findAnnotationDescriptor(ClassSE<?> clazz, ClassSE<T> annotationType) 指定された ClassSE で指定された annotationType の MetaAnnotationUtils.AnnotationDescriptor を検索し、指定されたクラス自体にアノテーションが見つからない場合は、そのアノテーション、インターフェース、スーパークラスをトラバースします。 |
static MetaAnnotationUtils.UntypedAnnotationDescriptor | findAnnotationDescriptorForTypes(ClassSE<?> clazz, ClassSE<? extends AnnotationSE>... annotationTypes) 指定された annotationTypes の少なくとも 1 つを宣言する、指定された clazz (指定された clazz 自体を含む)の継承階層の最初の ClassSE の 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)
ClassSE で指定された annotationType の MetaAnnotationUtils.AnnotationDescriptor を検索し、指定されたクラス自体にアノテーションが見つからない場合は、そのアノテーション、インターフェース、スーパークラスをトラバースします。このメソッドは、継承SE として宣言されていないクラスレベルのアノテーションとメタアノテーションを明示的に処理します。
アルゴリズムは次のように動作します。
AnnotationDescriptor を返します。このコンテキストでは、この用語は再帰的に、現在のアノテーション、インターフェース、スーパークラスをアノテーションを検索するクラスとしてステップ #1 に戻ることによって検索プロセスが続行されることを意味します。
clazz - アノテーションを探すクラス annotationType - 検索するアノテーションの型 nullfindAnnotationDescriptorForTypes(Class, Class...)@Nullable public static MetaAnnotationUtils.UntypedAnnotationDescriptor findAnnotationDescriptorForTypes(ClassSE<?> clazz, ClassSE<? extends AnnotationSE>... annotationTypes)
annotationTypes の少なくとも 1 つを宣言する、指定された clazz (指定された clazz 自体を含む)の継承階層の最初の ClassSE の MetaAnnotationUtils.UntypedAnnotationDescriptor を見つけます。 このメソッドは、指定されたクラス自体にアノテーションが見つからない場合、指定された clazz のアノテーション、インターフェース、スーパークラスをトラバースします。
このメソッドは、継承SE として宣言されていないクラスレベルのアノテーションとメタアノテーションを明示的に処理します。
アルゴリズムは次のように動作します。
UntypedAnnotationDescriptor を返します。このコンテキストでは、この用語は再帰的に、現在のアノテーション、インターフェース、スーパークラスをアノテーションを検索するクラスとしてステップ #1 に戻ることによって検索プロセスが続行されることを意味します。
clazz - アノテーションを探すクラス annotationTypes - 探すアノテーションの種類 nullfindAnnotationDescriptor(Class, Class)