public class MethodParameter extends ObjectSE
Method
SE または Constructor
SE に加えて、宣言されたジェネリクス型のパラメーターインデックスとネストされた型インデックス。渡すための仕様オブジェクトとして有用です。4.2 の時点で、属性エイリアスを使用してアノテーションを合成する SynthesizingMethodParameter
サブクラスが利用可能です。そのサブクラスは、特に Web およびメッセージエンドポイントの処理に使用されます。
SynthesizingMethodParameter
コンストラクターと説明 |
---|
MethodParameter(ConstructorSE<?> constructor, int parameterIndex) ネストレベル 1 で、指定されたコンストラクターの新しい MethodParameter を作成します。 |
MethodParameter(ConstructorSE<?> constructor, int parameterIndex, int nestingLevel) 指定されたコンストラクターの新しい MethodParameter を作成します。 |
MethodParameter(MethodSE method, int parameterIndex) ネストレベル 1 で、指定されたメソッドの新しい MethodParameter を作成します。 |
MethodParameter(MethodSE method, int parameterIndex, int nestingLevel) 指定されたメソッドの新しい MethodParameter を作成します。 |
MethodParameter(MethodParameter original) コピーコンストラクター。元のオブジェクトと同じメタデータとキャッシュ状態に基づいて、独立した MethodParameter オブジェクトを作成します。 |
修飾子と型 | メソッドと説明 |
---|---|
protected <A extends AnnotationSE> | adaptAnnotation(A annotation) 呼び出し元に返す前に特定のアノテーションインスタンスを後処理するテンプレートメソッド。 |
protected AnnotationSE[] | adaptAnnotationArray(AnnotationSE[] annotations) 呼び出し元に返す前に特定のアノテーション配列を後処理するテンプレートメソッド。 |
MethodParameter | clone() |
void | decreaseNestingLevel() 使用すべきではありません。 5.2 は元の MethodParameter を保持し、ネストが必要な場合は nested(Integer) を使用するため |
boolean | equals(ObjectSE other) |
protected static int | findParameterIndex(ParameterSE parameter) |
static MethodParameter | forExecutable(ExecutableSE executable, int parameterIndex) 指定されたメソッドまたはコンストラクターの新しい MethodParameter を作成します。 |
static MethodParameter | forMethodOrConstructor(ObjectSE methodOrConstructor, int parameterIndex) 使用すべきではありません。 |
static MethodParameter | forParameter(ParameterSE parameter) 指定されたパラメーター記述子の新しい MethodParameter を作成します。 |
AnnotatedElementSE | getAnnotatedElement() ラップされたアノテーション付き要素を返します。 |
ConstructorSE<?> | getConstructor() ラップされたコンストラクターがある場合はそれを返します。 |
ClassSE<?> | getContainingClass() このメソッドパラメーターの包含クラスを返します。 |
ClassSE<?> | getDeclaringClass() 基になるメソッドまたはコンストラクターを宣言するクラスを返します。 |
ExecutableSE | getExecutable() ラップされた実行可能ファイルを返します。 |
TypeSE | getGenericParameterType() メソッド / コンストラクターパラメーターのジェネリクス型を返します。 |
MemberSE | getMember() ラップされたメンバーを返します。 |
MethodSE | getMethod() ラップされたメソッドがあれば返します。 |
<A extends AnnotationSE> | getMethodAnnotation(ClassSE<A> annotationType) 可能な場合、指定された型のメソッド / コンストラクターアノテーションを返します。 |
AnnotationSE[] | getMethodAnnotations() ターゲットメソッド / コンストラクター自体に関連付けられているアノテーションを返します。 |
TypeSE | getNestedGenericParameterType() メソッド / コンストラクターパラメーターのネストされたジェネリクス型を返します。 |
ClassSE<?> | getNestedParameterType() メソッド / コンストラクターパラメーターのネストされた型を返します。 |
int | getNestingLevel() ターゲット型のネストレベルを返します(通常は 1。 |
ParameterSE | getParameter() メソッド / コンストラクターパラメーターの Parameter SE 記述子を返します。 |
<A extends AnnotationSE> | getParameterAnnotation(ClassSE<A> annotationType) 使用可能な場合、指定された型のパラメーターアノテーションを返します。 |
AnnotationSE[] | getParameterAnnotations() 特定のメソッド / コンストラクターパラメーターに関連付けられているアノテーションを返します。 |
int | getParameterIndex() メソッド / コンストラクターパラメーターのインデックスを返します。 |
StringSE | getParameterName() メソッド / コンストラクターのパラメーターの名前を返します。 |
ClassSE<?> | getParameterType() メソッド / コンストラクターのパラメーターの型を返します。 |
IntegerSE | getTypeIndexForCurrentLevel() 現在のネストレベルの型インデックスを返します。 |
IntegerSE | getTypeIndexForLevel(int nestingLevel) 指定されたネストレベルの型インデックスを返します。 |
int | hashCode() |
<A extends AnnotationSE> | hasMethodAnnotation(ClassSE<A> annotationType) メソッド / コンストラクターに指定された型のアノテーションが付けられているかどうかを返します。 |
<A extends AnnotationSE> | hasParameterAnnotation(ClassSE<A> annotationType) 指定されたアノテーション型でパラメーターが宣言されているかどうかを返します。 |
boolean | hasParameterAnnotations() パラメーターに少なくとも 1 つのアノテーションがある場合は true を返し、ない場合は false を返します。 |
void | increaseNestingLevel() 使用すべきではありません。 5.2 以降、 nested(Integer) を推奨 |
void | initParameterNameDiscovery(ParameterNameDiscoverer parameterNameDiscoverer) このメソッドパラメーターのパラメーター名の検出を初期化します。 |
boolean | isOptional() このメソッドが不要なパラメーターを示しているかどうかを返します: Java 8 の Optional SE の形式、パラメーターレベルの Nullable アノテーション(JSR-305 または FindBugs のアノテーションセットなど)のいずれかの形式、または言語レベルの nullable Kotlin の型宣言または Continuation パラメーター。 |
MethodParameter | nested() この MethodParameter のバリアントを返します。これは、同じパラメーターを指しますが、ネストレベルが 1 つ深くなります。 |
MethodParameter | nested(IntegerSE typeIndex) この MethodParameter のバリアントを返します。これは、同じパラメーターを指しますが、ネストレベルが 1 つ深くなります。 |
MethodParameter | nestedIfOptional() Optional SE 宣言の場合、同じパラメーターを指しますが、ネストレベルが 1 つ深いこの MethodParameter のバリアントを返します。 |
void | setTypeIndexForCurrentLevel(int typeIndex) 使用すべきではありません。 5.2 以降、 withTypeIndex(int) を推奨 |
StringSE | toString() |
MethodParameter | withContainingClass(ClassSE<?> containingClass) 指定された包含クラスを参照するこの MethodParameter のバリアントを返します。 |
MethodParameter | withTypeIndex(int typeIndex) 現在のレベルの型を指定された値に設定して、この MethodParameter のバリアントを返します。 |
finalizeSE, getClassSE, notifySE, notifyAllSE, waitSE, waitSE, waitSE
public MethodParameter(MethodSE method, int parameterIndex)
MethodParameter
を作成します。method
- パラメーターを指定するメソッド parameterIndex
- パラメーターのインデックス: メソッドの戻り値の型の場合は -1。最初のメソッドパラメーターの場合は 0。2 番目のメソッドパラメーターなどの場合は 1public MethodParameter(MethodSE method, int parameterIndex, int nestingLevel)
MethodParameter
を作成します。method
- パラメーターを指定するメソッド parameterIndex
- パラメーターのインデックス: メソッドの戻り値の型の場合は -1。最初のメソッドパラメーターの場合は 0。2 番目のメソッドパラメーターなどの場合は 1nestingLevel
- ターゲット型のネストレベル (通常 1。たとえばリストのリストの場合、1 はネストされたリストを示し、2 はネストされたリストの要素を示します)public MethodParameter(ConstructorSE<?> constructor, int parameterIndex)
constructor
- パラメーターを指定するコンストラクター parameterIndex
- パラメーターのインデックス public MethodParameter(ConstructorSE<?> constructor, int parameterIndex, int nestingLevel)
constructor
- パラメーターを指定するコンストラクター parameterIndex
- パラメーターのインデックス nestingLevel
- ターゲット型のネストレベル (通常 1。たとえばリストのリストの場合、1 はネストされたリストを示し、2 はネストされたリストの要素を示します)public MethodParameter(MethodParameter original)
original
- コピー元の MethodParameter オブジェクト @Nullable public MethodSE getMethod()
メモ: Method または Constructor のいずれかを使用できます。
null
@Nullable public ConstructorSE<?> getConstructor()
メモ: Method または Constructor のいずれかを使用できます。
null
public ClassSE<?> getDeclaringClass()
public MemberSE getMember()
public AnnotatedElementSE getAnnotatedElement()
メモ: このメソッドは、メソッド / コンストラクター自体で(つまり、パラメーターレベルではなく、メソッド / コンストラクターレベルで)宣言されたアノテーションを公開します。
public ExecutableSE getExecutable()
public ParameterSE getParameter()
Parameter
SE 記述子を返します。public int getParameterIndex()
@DeprecatedSE public void increaseNestingLevel()
nested(Integer)
を推奨する 5.2 以降 getNestingLevel()
@DeprecatedSE public void decreaseNestingLevel()
nested(Integer)
を使用するため getNestingLevel()
public int getNestingLevel()
public MethodParameter withTypeIndex(int typeIndex)
MethodParameter
のバリアントを返します。typeIndex
- 新しい型のインデックス @DeprecatedSE public void setTypeIndexForCurrentLevel(int typeIndex)
withTypeIndex(int)
を推奨する 5.2 以降 typeIndex
- 対応する型インデックス (または、デフォルトの型インデックスの場合は null
)getNestingLevel()
@Nullable public IntegerSE getTypeIndexForCurrentLevel()
null
(デフォルトの型インデックスを示す)getNestingLevel()
@Nullable public IntegerSE getTypeIndexForLevel(int nestingLevel)
nestingLevel
- チェックするネストレベル null
(デフォルトの型インデックスを示す)public MethodParameter nested()
MethodParameter
のバリアントを返します。これは、同じパラメーターを指しますが、ネストレベルが 1 つ深くなります。public MethodParameter nested(@Nullable IntegerSE typeIndex)
MethodParameter
のバリアントを返します。これは、同じパラメーターを指しますが、ネストレベルが 1 つ深くなります。typeIndex
- 新しいネストレベルの型インデックス public boolean isOptional()
Optional
SE の形式、パラメーターレベルの Nullable
アノテーション(JSR-305 または FindBugs のアノテーションセットなど)のいずれかの形式、または言語レベルの nullable Kotlin の型宣言または Continuation
パラメーター。public MethodParameter nestedIfOptional()
Optional
SE 宣言の場合、同じパラメーターを指しますが、ネストレベルが 1 つ深いこの MethodParameter
のバリアントを返します。isOptional()
, nested()
public MethodParameter withContainingClass(@Nullable ClassSE<?> containingClass)
MethodParameter
のバリアントを返します。containingClass
- 特定の包含クラス (潜在的に宣言クラスのサブクラス、たとえば型変数の置換)getParameterType()
public ClassSE<?> getContainingClass()
getDeclaringClass()
public ClassSE<?> getParameterType()
null
)public TypeSE getGenericParameterType()
null
)public ClassSE<?> getNestedParameterType()
null
)getNestingLevel()
public TypeSE getNestedGenericParameterType()
null
)getNestingLevel()
public AnnotationSE[] getMethodAnnotations()
@Nullable public <A extends AnnotationSE> A getMethodAnnotation(ClassSE<A> annotationType)
annotationType
- 検索するアノテーション型 null
public <A extends AnnotationSE> boolean hasMethodAnnotation(ClassSE<A> annotationType)
annotationType
- 検索するアノテーション型 getMethodAnnotation(Class)
public AnnotationSE[] getParameterAnnotations()
public boolean hasParameterAnnotations()
true
を返し、ない場合は false
を返します。@Nullable public <A extends AnnotationSE> A getParameterAnnotation(ClassSE<A> annotationType)
annotationType
- 検索するアノテーション型 null
public <A extends AnnotationSE> boolean hasParameterAnnotation(ClassSE<A> annotationType)
annotationType
- 検索するアノテーション型 getParameterAnnotation(Class)
public void initParameterNameDiscovery(@Nullable ParameterNameDiscoverer parameterNameDiscoverer)
このメソッドは、実際にはこの時点でパラメーター名を取得しようとしません。アプリケーションが getParameterName()
を呼び出したときにディスカバリが発生するようにします(もしあれば)。
@Nullable public StringSE getParameterName()
ParameterNameDiscoverer
が始まるように設定されていない場合は、null
になります。)protected <A extends AnnotationSE> A adaptAnnotation(A annotation)
デフォルトの実装は、指定されたアノテーションをそのまま返すだけです。
annotation
- 返されるアノテーション protected AnnotationSE[] adaptAnnotationArray(AnnotationSE[] annotations)
デフォルトの実装は、指定されたアノテーション配列をそのまま返すだけです。
annotations
- 返されようとしているアノテーション配列 public int hashCode()
ObjectSE
の hashCodeSE
public StringSE toString()
ObjectSE
の toStringSE
public MethodParameter clone()
@DeprecatedSE public static MethodParameter forMethodOrConstructor(ObjectSE methodOrConstructor, int parameterIndex)
forExecutable(java.lang.reflect.Executable, int)
を推奨 これは、メソッドまたはコンストラクターの参照が一般的な方法で処理されるシナリオの便利なファクトリメソッドです。
methodOrConstructor
- パラメーターを指定するメソッドまたはコンストラクター parameterIndex
- パラメーターのインデックス public static MethodParameter forExecutable(ExecutableSE executable, int parameterIndex)
これは、メソッドまたはコンストラクターの参照が一般的な方法で処理されるシナリオの便利なファクトリメソッドです。
executable
- パラメーターを指定するメソッドまたはコンストラクター parameterIndex
- パラメーターのインデックス public static MethodParameter forParameter(ParameterSE parameter)
これは、Java 8 Parameter
SE 記述子がすでに利用可能なシナリオの便利なファクトリメソッドです。
parameter
- パラメーター記述子 protected static int findParameterIndex(ParameterSE parameter)