A
- アノテーション型 public interface MergedAnnotation<A extends AnnotationSE>
MergedAnnotations
コレクションから返された 1 つのマージされたアノテーション。属性値がさまざまなソース値から「マージ」された可能性のあるアノテーションのビューを表示します。 属性値には、さまざまな get
メソッドを使用してアクセスできます。例: int
属性にアクセスするには、getInt(String)
メソッドが使用されます。
アクセス時に属性値は変換されないことに注意してください。例: 基本となる属性が int
の場合、getString(String)
を呼び出すことはできません。このルールの唯一の例外は、Class
および Class[]
の値です。これらの値は、String
および String[]
としてそれぞれアクセスされ、潜在的な初期クラスの初期化を防止します。
必要に応じて、MergedAnnotation
を合成して実際の Annotation
SE に戻すことができます。
MergedAnnotations
, MergedAnnotationPredicates
修飾子と型 | インターフェースと説明 |
---|---|
static class | MergedAnnotation.Adapt Maps または AnnotationAttributes の作成時に属性値に適用できる適応。 |
修飾子と型 | メソッドと説明 |
---|---|
AnnotationAttributes | asAnnotationAttributes(MergedAnnotation.Adapt... adaptations) このマージされたアノテーションから新しい可変 AnnotationAttributes インスタンスを作成します。 |
<T extends MapSE<StringSE, ObjectSE>> | asMap(FunctionSE<MergedAnnotation<?>,T> factory, MergedAnnotation.Adapt... adaptations) すべてのアノテーション属性を含む、指定された型の新しい Map SE インスタンスを作成します。 |
MapSE<StringSE, ObjectSE> | asMap(MergedAnnotation.Adapt... adaptations) すべてのアノテーション属性を含む不変の Map SE を取得します。 |
MergedAnnotation<A> | filterAttributes(PredicateSE<StringSE> predicate) 指定された述語に一致する属性のみを持つアノテーションの新しいビューを作成します。 |
MergedAnnotation<A> | filterDefaultValues() デフォルト値が削除されたすべての属性を使用して、アノテーションの新しいビューを作成します。 |
static <A extends AnnotationSE> | from(A annotation) 指定されたアノテーションから新しい MergedAnnotation インスタンスを作成します。 |
static <A extends AnnotationSE> | from(ObjectSE source, A annotation) 指定されたアノテーションから新しい MergedAnnotation インスタンスを作成します。 |
int | getAggregateIndex() このアノテーションを含む集約コレクションのインデックスを取得します。 |
<T extends AnnotationSE> | getAnnotation(StringSE attributeName, ClassSE<T> type) アノテーションから必要なアノテーション属性値を取得します。 |
<T extends AnnotationSE> | getAnnotationArray(StringSE attributeName, ClassSE<T> type) 必要なアノテーション配列属性値をアノテーションから取得します。 |
boolean | getBoolean(StringSE attributeName) アノテーションから必要なブール属性値を取得します。 |
boolean[] | getBooleanArray(StringSE attributeName) アノテーションから必要なブール配列属性値を取得します。 |
byte | getByte(StringSE attributeName) アノテーションから必要なバイト属性値を取得します。 |
byte[] | getByteArray(StringSE attributeName) アノテーションから必要なバイト配列属性値を取得します。 |
char | getChar(StringSE attributeName) アノテーションから必要な char 属性値を取得します。 |
char[] | getCharArray(StringSE attributeName) アノテーションから必要な文字配列属性値を取得します。 |
ClassSE<?> | getClass(StringSE attributeName) アノテーションから必要なクラス属性値を取得します。 |
ClassSE<?>[] | getClassArray(StringSE attributeName) アノテーションから必要なクラス配列属性値を取得します。 |
OptionalSE<ObjectSE> | getDefaultValue(StringSE attributeName) アノテーション宣言で指定されているように、アノテーションからデフォルトの属性値を取得します。 |
<T> OptionalSE<T> | getDefaultValue(StringSE attributeName, ClassSE<T> type) アノテーション宣言で指定されているように、アノテーションからデフォルトの属性値を取得します。 |
int | getDistance() メタアノテーションとしての使用に関連するこのアノテーションの距離を取得します。 |
double | getDouble(StringSE attributeName) アノテーションから必要な double 属性値を取得します。 |
double[] | getDoubleArray(StringSE attributeName) アノテーションから必要な二重配列属性値を取得します。 |
<E extends EnumSE<E>> | getEnum(StringSE attributeName, ClassSE<E> type) アノテーションから必要な列挙型属性値を取得します。 |
<E extends EnumSE<E>> | getEnumArray(StringSE attributeName, ClassSE<E> type) アノテーションから必要な列挙型配列属性値を取得します。 |
float | getFloat(StringSE attributeName) アノテーションから必要なフロート属性値を取得します。 |
float[] | getFloatArray(StringSE attributeName) アノテーションから必要なフロート配列属性値を取得します。 |
int | getInt(StringSE attributeName) アノテーションから必要な int 属性値を取得します。 |
int[] | getIntArray(StringSE attributeName) アノテーションから必要な int 配列属性値を取得します。 |
long | getLong(StringSE attributeName) アノテーションから必要な長い属性値を取得します。 |
long[] | getLongArray(StringSE attributeName) アノテーションから必要な長い配列属性値を取得します。 |
MergedAnnotation<?> | getMetaSource() メタアノテーションのソースを取得します。アノテーションがメタ表示でない場合は null を取得します。 |
ListSE<ClassSE<? extends AnnotationSE>> | getMetaTypes() このアノテーションから root までのアノテーション階層内のアノテーション型の完全なリストを取得します。 |
MergedAnnotation<?> | getRoot() ルートアノテーションを取得します。 |
short | getShort(StringSE attributeName) アノテーションから必要な短い属性値を取得します。 |
short[] | getShortArray(StringSE attributeName) アノテーションから必要な短い配列属性値を取得します。 |
ObjectSE | getSource() 最終的にルートアノテーションを宣言したソースを取得します。ソースが不明の場合は null を取得します。 |
StringSE | getString(StringSE attributeName) アノテーションから必要な文字列属性値を取得します。 |
StringSE[] | getStringArray(StringSE attributeName) アノテーションから必要な文字列配列属性値を取得します。 |
ClassSE<A> | getType() 実際のアノテーション型の Class 参照を取得します。 |
OptionalSE<ObjectSE> | getValue(StringSE attributeName) アノテーションからオプションの属性値を取得します。 |
<T> OptionalSE<T> | getValue(StringSE attributeName, ClassSE<T> type) アノテーションからオプションの属性値を取得します。 |
boolean | hasDefaultValue(StringSE attributeName) アノテーション宣言と比較したときに、指定された属性名にデフォルト値があるかどうかを判別します。 |
boolean | hasNonDefaultValue(StringSE attributeName) アノテーション宣言と比較したときに、指定された属性名にデフォルト以外の値があるかどうかを判別します。 |
boolean | isDirectlyPresent() アノテーションがソースに直接存在するかどうかを確認します。 |
boolean | isMetaPresent() アノテーションがソースにメタ表示されているかどうかを確認します。 |
boolean | isPresent() アノテーションがソースに存在するかどうかを確認します。 |
static <A extends AnnotationSE> | missing() 欠落しているアノテーションを表す MergedAnnotation を作成します(つまり |
static <A extends AnnotationSE> | of(AnnotatedElementSE source, ClassSE<A> annotationType, MapSE<StringSE,?> attributes) マップが提供する属性値を使用して、指定されたアノテーション型の新しい MergedAnnotation インスタンスを作成します。 |
static <A extends AnnotationSE> | of(ClassSE<A> annotationType) 指定されたアノテーション型の新しい MergedAnnotation インスタンスを作成します。 |
static <A extends AnnotationSE> | of(ClassSE<A> annotationType, MapSE<StringSE,?> attributes) マップが提供する属性値を使用して、指定されたアノテーション型の新しい MergedAnnotation インスタンスを作成します。 |
static <A extends AnnotationSE> | of(ClassLoaderSE classLoader, ObjectSE source, ClassSE<A> annotationType, MapSE<StringSE,?> attributes) マップが提供する属性値を使用して、指定されたアノテーション型の新しい MergedAnnotation インスタンスを作成します。 |
A | synthesize() コードで直接使用できるこのアノテーションの型安全な合成バージョンを作成します。 |
OptionalSE<A> | synthesize(PredicateSE<? super MergedAnnotation<A>> condition) 必要に応じて、条件述語に基づいて、このアノテーションの型安全な合成バージョンを作成します。 |
MergedAnnotation<A> | withNonMergedAttributes() マージされていない属性値を公開するアノテーションの新しいビューを作成します。 |
boolean isPresent()
MergedAnnotations.SearchStrategy
のコンテキスト内で直接存在 するアノテーションとメタ提示アノテーションを考慮します。true
boolean isDirectlyPresent()
直接存在するアノテーションは、ユーザーが明示的に宣言したアノテーションであり、メタ提示または @Inherited
SE ではありません。
true
boolean isMetaPresent()
メタ提示アノテーションは、ユーザーが明示的に宣言していないアノテーションですが、アノテーション階層のどこかでメタアノテーションとして使用されています。
true
int getDistance()
直接宣言されたアノテーションの距離は 0
、メタアノテーションの距離は 1
、メタアノテーションのメタアノテーションの距離は 2
などです。欠落したアノテーションは常に -1
の距離を返します。
-1
int getAggregateIndex()
アノテーションのストリームを並べ替えるために使用できます。たとえば、スーパークラスまたはインターフェースで宣言されたアノテーションにより高い優先度を与えることができます。欠落したアノテーションは常に -1
の集約インデックスを返します。
0
から始まる)、またはアノテーションがない場合は -1
@Nullable ObjectSE getSource()
null
を取得します。 このマージされたアノテーションが from
および AnnotatedElement
SE で作成された場合、このソースは同じ型の要素になります。アノテーションをリフレクションを使用せずにロードした場合、ソースはどの型でもかまいませんが、適切な toString()
が必要です。メタアノテーションは常に root
と同じソースを返します。
null
@Nullable MergedAnnotation<?> getMetaSource()
null
getRoot()
MergedAnnotation<?> getRoot()
distance
0
アノテーションを取得します。getMetaSource()
ListSE<ClassSE<? extends AnnotationSE>> getMetaTypes()
root
までのアノテーション階層内のアノテーション型の完全なリストを取得します。マージされたアノテーションインスタンスを一意に識別するための便利な方法を提供します。
MergedAnnotationPredicates.unique(Function)
, getRoot()
, getMetaSource()
boolean hasNonDefaultValue(StringSE attributeName)
attributeName
- 属性名 true
(属性値がデフォルト値と異なる場合)boolean hasDefaultValue(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 true
(属性値がデフォルト値と同じ場合)NoSuchElementExceptionSE
byte getByte(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 byte[] getByteArray(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 boolean getBoolean(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 boolean[] getBooleanArray(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 char getChar(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 char[] getCharArray(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 short getShort(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 short[] getShortArray(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 int getInt(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 int[] getIntArray(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 long getLong(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 long[] getLongArray(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 double getDouble(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 double[] getDoubleArray(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 float getFloat(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 float[] getFloatArray(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 StringSE getString(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 StringSE[] getStringArray(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 ClassSE<?> getClass(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 ClassSE<?>[] getClassArray(StringSE attributeName) throws NoSuchElementExceptionSE
attributeName
- 属性名 NoSuchElementExceptionSE
- 一致する属性がない場合 <E extends EnumSE<E>> E getEnum(StringSE attributeName, ClassSE<E> type) throws NoSuchElementExceptionSE
attributeName
- 属性名 type
- 列挙型 NoSuchElementExceptionSE
- 一致する属性がない場合 <E extends EnumSE<E>> E[] getEnumArray(StringSE attributeName, ClassSE<E> type) throws NoSuchElementExceptionSE
attributeName
- 属性名 type
- 列挙型 NoSuchElementExceptionSE
- 一致する属性がない場合 <T extends AnnotationSE> MergedAnnotation<T> getAnnotation(StringSE attributeName, ClassSE<T> type) throws NoSuchElementExceptionSE
attributeName
- 属性名 type
- アノテーション型 MergedAnnotation
としての値 NoSuchElementExceptionSE
- 一致する属性がない場合 <T extends AnnotationSE> MergedAnnotation<T>[] getAnnotationArray(StringSE attributeName, ClassSE<T> type) throws NoSuchElementExceptionSE
attributeName
- 属性名 type
- アノテーション型 MergedAnnotation
配列としての値 NoSuchElementExceptionSE
- 一致する属性がない場合 OptionalSE<ObjectSE> getValue(StringSE attributeName)
attributeName
- 属性名 Optional.empty()
SE<T> OptionalSE<T> getValue(StringSE attributeName, ClassSE<T> type)
attributeName
- 属性名 type
- 属性型。基になる属性型または Object.class
と互換性がある必要があります。Optional.empty()
SEOptionalSE<ObjectSE> getDefaultValue(StringSE attributeName)
attributeName
- 属性名 Optional.empty()
SE<T> OptionalSE<T> getDefaultValue(StringSE attributeName, ClassSE<T> type)
attributeName
- 属性名 type
- 属性型。基になる属性型または Object.class
と互換性がある必要があります。Optional.empty()
SEMergedAnnotation<A> filterDefaultValues()
filterAttributes(Predicate)
MergedAnnotation<A> filterAttributes(PredicateSE<StringSE> predicate)
predicate
- 属性名をフィルタリングするために使用される述語 filterDefaultValues()
, MergedAnnotationPredicates
MergedAnnotation<A> withNonMergedAttributes()
このビューのメソッドは、エイリアスミラーリングルールのみが適用された属性値を返します。meta-source
属性へのエイリアスは適用されません。
AnnotationAttributes asAnnotationAttributes(MergedAnnotation.Adapt... adaptations)
AnnotationAttributes
インスタンスを作成します。adaptations
を使用して、値の追加方法を変更できます。
adaptations
- アノテーション値に適用する必要がある適応 MapSE<StringSE,ObjectSE> asMap(MergedAnnotation.Adapt... adaptations)
Map
SE を取得します。adaptations
を使用して、値の追加方法を変更できます。
adaptations
- アノテーション値に適用する必要がある適応 <T extends MapSE<StringSE,ObjectSE>> T asMap(FunctionSE<MergedAnnotation<?>,T> factory, MergedAnnotation.Adapt... adaptations)
Map
SE インスタンスを作成します。adaptations
を使用して、値の追加方法を変更できます。
factory
- 地図ファクトリ adaptations
- アノテーション値に適用する必要がある適応 A synthesize() throws NoSuchElementExceptionSE
結果は JDK Proxy
SE を使用して合成され、その結果、最初に呼び出されたときに計算コストが発生する可能性があります。
NoSuchElementExceptionSE
- 不足しているアノテーション OptionalSE<A> synthesize(PredicateSE<? super MergedAnnotation<A>> condition) throws NoSuchElementExceptionSE
結果は JDK Proxy
SE を使用して合成され、その結果、最初に呼び出されたときに計算コストが発生する可能性があります。
condition
- アノテーションを合成できるかどうかを判断するテスト NoSuchElementExceptionSE
- 不足しているアノテーション MergedAnnotationPredicates
static <A extends AnnotationSE> MergedAnnotation<A> missing()
MergedAnnotation
を作成します。static <A extends AnnotationSE> MergedAnnotation<A> from(A annotation)
MergedAnnotation
インスタンスを作成します。annotation
- 含めるアノテーション MergedAnnotation
インスタンス static <A extends AnnotationSE> MergedAnnotation<A> from(@Nullable ObjectSE source, A annotation)
MergedAnnotation
インスタンスを作成します。source
- アノテーションのソース。このソースは、情報とロギングのためにのみ使用されます。指定されたアノテーションを実際に含む必要はなく、検索されません。annotation
- 含めるアノテーション MergedAnnotation
インスタンス static <A extends AnnotationSE> MergedAnnotation<A> of(ClassSE<A> annotationType)
MergedAnnotation
インスタンスを作成します。結果のアノテーションには属性値はありませんが、デフォルト値のクエリに引き続き使用できます。annotationType
- アノテーション型 MergedAnnotation
インスタンス static <A extends AnnotationSE> MergedAnnotation<A> of(ClassSE<A> annotationType, @Nullable MapSE<StringSE,?> attributes)
MergedAnnotation
インスタンスを作成します。annotationType
- アノテーション型 attributes
- アノテーション属性、またはデフォルト値のみを使用する場合は null
MergedAnnotation
インスタンス of(AnnotatedElement, Class, Map)
static <A extends AnnotationSE> MergedAnnotation<A> of(@Nullable AnnotatedElementSE source, ClassSE<A> annotationType, @Nullable MapSE<StringSE,?> attributes)
MergedAnnotation
インスタンスを作成します。source
- アノテーションのソース。このソースは、情報とロギングのためにのみ使用されます。指定されたアノテーションを実際に含む必要はなく、検索されません。annotationType
- アノテーション型 attributes
- アノテーション属性、またはデフォルト値のみを使用する場合は null
MergedAnnotation
インスタンス static <A extends AnnotationSE> MergedAnnotation<A> of(@Nullable ClassLoaderSE classLoader, @Nullable ObjectSE source, ClassSE<A> annotationType, @Nullable MapSE<StringSE,?> attributes)
MergedAnnotation
インスタンスを作成します。classLoader
- クラス属性を解決するために使用されるクラスローダー source
- アノテーションのソース。このソースは、情報とロギングのためにのみ使用されます。指定されたアノテーションを実際に含む必要はなく、検索されません。annotationType
- アノテーション型 attributes
- アノテーション属性、またはデフォルト値のみを使用する場合は null
MergedAnnotation
インスタンス