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