|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
java.lang.Objectorg.seasar.util.lang.MethodUtil
public abstract class MethodUtil
Method用のユーティリティクラスです。
| コンストラクタの概要 | |
|---|---|
MethodUtil()
|
|
| メソッドの概要 | ||
|---|---|---|
static Class<?> |
getElementTypeOfCollectionFromParameterType(Method method,
int position)
メソッドの引数型 (パラメタ化されたコレクション) の要素型を返します。 |
|
static Class<?> |
getElementTypeOfCollectionFromReturnType(Method method)
指定されたメソッドの戻り値型として宣言されているパラメタ化されたコレクションの要素型を返します。 |
|
static Class<?> |
getKeyTypeOfMapFromParameterType(Method method,
int position)
メソッドの引数型 (パラメタ化されたマップ) のキー型を返します。 |
|
static Class<?> |
getKeyTypeOfMapFromReturnType(Method method)
指定されたメソッドの戻り値型として宣言されているパラメタ化されたマップのキー型を返します。 |
|
static String |
getSignature(String methodName,
Class<?>... argTypes)
シグニチャの文字列表現を返します。 |
|
static String |
getSignature(String methodName,
Object... methodArgs)
シグニチャの文字列表現を返します。 |
|
static Class<?> |
getValueTypeOfMapFromParameterType(Method method,
int position)
メソッドの引数型 (パラメタ化されたマップ) の値型を返します。 |
|
static Class<?> |
getValueTypeOfMapFromReturnType(Method method)
指定されたメソッドの戻り値型として宣言されているパラメタ化されたマップの値型を返します。 |
|
static
|
invoke(Method method,
Object target,
Object... args)
Methodオブジェクトによって表される基本となるメソッドを、指定したオブジェクトに対して指定したパラメータで呼び出します。 |
|
static
|
invokeStatic(Method method,
Object... args)
Methodオブジェクトによって表される基本となるstaticメソッドを、指定したパラメータで呼び出します。 |
|
static boolean |
isAbstract(Method method)
abstractかどうかを返します。 |
|
static boolean |
isEqualsMethod(Method method)
equals(Object)メソッドかどうかを返します。 |
|
static boolean |
isFinal(Method method)
finalかどうかを返します。 |
|
static boolean |
isHashCodeMethod(Method method)
hashCode()メソッドかどうか返します。 |
|
static boolean |
isPublic(Method method)
publicかどうかを返します。 |
|
static boolean |
isStatic(Method method)
staticかどうかを返します。 |
|
static boolean |
isToStringMethod(Method method)
toString()メソッドかどうか返します。 |
|
| クラス java.lang.Object から継承されたメソッド |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| コンストラクタの詳細 |
|---|
public MethodUtil()
| メソッドの詳細 |
|---|
public static <T> T invoke(Method method,
Object target,
Object... args)
throws InvocationTargetRuntimeException,
IllegalAccessRuntimeException
Methodオブジェクトによって表される基本となるメソッドを、指定したオブジェクトに対して指定したパラメータで呼び出します。
T - メソッドの戻り値の型method - メソッド。nullであってはいけませんtarget - 基本となるメソッドの呼び出し元のオブジェクト。staticメソッドの場合はnullargs - メソッド呼び出しに使用される引数
argsを使用してobjにディスパッチした結果
IllegalAccessRuntimeException - このMethodオブジェクトがJava言語アクセス制御を実施し、 基本となるメソッドにアクセスできない場合
InvocationTargetRuntimeException - 基本となるメソッドが例外をスローする場合Method.invoke(Object, Object[])
public static <T> T invokeStatic(Method method,
Object... args)
throws InvocationTargetRuntimeException,
IllegalAccessRuntimeException
Methodオブジェクトによって表される基本となるstaticメソッドを、指定したパラメータで呼び出します。
T - メソッドの戻り値の型method - メソッド。nullであってはいけませんargs - メソッド呼び出しに使用される引数
staticメソッドを、パラメータargsを使用してディスパッチした結果
IllegalAccessRuntimeException - このMethodオブジェクトがJava言語アクセス制御を実施し、 基本となるメソッドにアクセスできない場合
InvocationTargetRuntimeException - 基本となるメソッドが例外をスローする場合Method.invoke(Object, Object[])public static boolean isAbstract(Method method)
abstractかどうかを返します。
method - メソッド。nullであってはいけません
abstractかどうかpublic static boolean isPublic(Method method)
publicかどうかを返します。
method - メソッド。nullであってはいけません
publicならtruepublic static boolean isStatic(Method method)
staticかどうかを返します。
method - メソッド。nullであってはいけません
staticかどうかpublic static boolean isFinal(Method method)
finalかどうかを返します。
method - メソッド。nullであってはいけません
final かどうか
public static String getSignature(String methodName,
Class<?>... argTypes)
methodName - メソッド名。nullや空文字列であってはいけませんargTypes - 引数型のな並び
public static String getSignature(String methodName,
Object... methodArgs)
methodName - メソッド名。nullや空文字列であってはいけませんmethodArgs - 引数の並び
public static boolean isEqualsMethod(Method method)
method - メソッド。nullであってはいけません
public static boolean isHashCodeMethod(Method method)
method - メソッド。nullであってはいけません
public static boolean isToStringMethod(Method method)
method - メソッド。nullであってはいけません
public static Class<?> getElementTypeOfCollectionFromParameterType(Method method,
int position)
method - メソッド。nullであってはいけませんposition - パラメタ化されたコレクションが宣言されているメソッド引数の位置
public static Class<?> getElementTypeOfCollectionFromReturnType(Method method)
method - メソッド。nullであってはいけません
public static Class<?> getKeyTypeOfMapFromParameterType(Method method,
int position)
method - メソッド。nullであってはいけませんposition - パラメタ化されたマップが宣言されているメソッド引数の位置
public static Class<?> getKeyTypeOfMapFromReturnType(Method method)
method - メソッド。nullであってはいけません
public static Class<?> getValueTypeOfMapFromParameterType(Method method,
int position)
method - メソッド。nullであってはいけませんposition - パラメタ化されたマップが宣言されているメソッド引数の位置
public static Class<?> getValueTypeOfMapFromReturnType(Method method)
method - メソッド。nullであってはいけません
|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||