パッケージ org.piax.util
クラス MethodUtil
java.lang.Object
org.piax.util.MethodUtil
public class MethodUtil extends Object
Method invocation utility
-
コンストラクタの概要
コンストラクタ コンストラクタ 説明 MethodUtil() -
メソッドの概要
修飾子とタイプ メソッド 説明 static Objectinvoke(Object target, Class<?> superIf, boolean localCall, String methodName, Object... args)Note: the specified method and its declared class should have the public modifier.static Objectinvoke(Object target, Class<?> superIf, String methodName, Object... args)static Objectinvoke(Object target, String methodName, Object... args)Note: the specified method and its declared class should have the public modifier.static MethodstrictGetMethod(Class<?> targetClass, Class<?> superIf, String methodName, Object... args)オブジェクトの呼び出すべきメソッドを探しだす。static ObjectstrictInvoke(Object target, Class<?> superIf, boolean localCall, String methodName, Object... args)オブジェクトのメソッドを呼び出す。
-
コンストラクタの詳細
-
MethodUtil
public MethodUtil()
-
-
メソッドの詳細
-
invoke
public static Object invoke(Object target, String methodName, Object... args) throws NoSuchMethodException, InvocationTargetExceptionNote: the specified method and its declared class should have the public modifier.- パラメータ:
target- target objectmethodName- method nameargs- the arguments used for the method call- 戻り値:
- the result of invoking the method
- 例外:
NoSuchMethodException- if a matching method is not foundInvocationTargetException- if the underlying method throws an exception.
-
invoke
public static Object invoke(Object target, Class<?> superIf, String methodName, Object... args) throws NoSuchMethodException, InvocationTargetException -
invoke
public static Object invoke(Object target, Class<?> superIf, boolean localCall, String methodName, Object... args) throws NoSuchMethodException, InvocationTargetExceptionNote: the specified method and its declared class should have the public modifier.- パラメータ:
target- target objectsuperIf- super interfacelocalCall- called from local peermethodName- method nameargs- the arguments used for the method call- 戻り値:
- the result of invoking the method
- 例外:
NoSuchMethodException- if a matching method is not foundInvocationTargetException- if the underlying method throws an exception.
-
strictGetMethod
public static Method strictGetMethod(Class<?> targetClass, Class<?> superIf, String methodName, Object... args) throws NoSuchMethodExceptionオブジェクトの呼び出すべきメソッドを探しだす。実引数の型互換と可変長引数部の配列化が済んでいる前提で処理が簡素化 されている。
- パラメータ:
targetClass- class of target objectsuperIf- super interfacemethodName- method nameargs- the arguments used for the method call- 戻り値:
- method to invoke
- 例外:
NoSuchMethodException- if a matching method is not found
-
strictInvoke
public static Object strictInvoke(Object target, Class<?> superIf, boolean localCall, String methodName, Object... args) throws NoSuchMethodException, InvocationTargetExceptionオブジェクトのメソッドを呼び出す。但し、invokeと違って、実引数の型互換と可変長引数部の配列化が済んでいる前提で処理が簡素化 されている。 例えば、reflect.Proxyを使って、InvocationHandler.invokeから実引数を取得する RPCInvokerの場合はこのメソッドを呼び出す方が効率的である。
- パラメータ:
target- target objectsuperIf- super interfacelocalCall- true if it is local call.methodName- method nameargs- the arguments used for the method call- 戻り値:
- the result of invoking the method
- 例外:
NoSuchMethodException- if a matching method is not foundInvocationTargetException- if the underlying method throws an exception.
-