public class MethodUtil extends Object
| コンストラクタと説明 |
|---|
MethodUtil() |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
static Object |
invoke(Object target,
Class<?> superIf,
boolean localCall,
String methodName,
Object... args)
Note: the specified method and its declared class should have
the public modifier.
|
static Object |
invoke(Object target,
Class<?> superIf,
String methodName,
Object... args) |
static Object |
invoke(Object target,
String methodName,
Object... args)
Note: the specified method and its declared class should have
the public modifier.
|
static Method |
strictGetMethod(Class<?> targetClass,
Class<?> superIf,
String methodName,
Object... args)
オブジェクトの呼び出すべきメソッドを探しだす。
|
static Object |
strictInvoke(Object target,
Class<?> superIf,
boolean localCall,
String methodName,
Object... args)
オブジェクトのメソッドを呼び出す。
|
public static Object invoke(Object target, String methodName, Object... args) throws NoSuchMethodException, InvocationTargetException
target - target objectmethodName - method nameargs - the arguments used for the method callNoSuchMethodException - if a matching method is not foundInvocationTargetException - if the underlying method
throws an exception.public static Object invoke(Object target, Class<?> superIf, String methodName, Object... args) throws NoSuchMethodException, InvocationTargetException
public static Object invoke(Object target, Class<?> superIf, boolean localCall, String methodName, Object... args) throws NoSuchMethodException, InvocationTargetException
target - target objectsuperIf - super interfacelocalCall - called from local peermethodName - method nameargs - the arguments used for the method callNoSuchMethodException - if a matching method is not foundInvocationTargetException - if the underlying method
throws an exception.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 callNoSuchMethodException - if a matching method is not foundpublic 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 callNoSuchMethodException - if a matching method is not foundInvocationTargetException - if the underlying method
throws an exception.Copyright © 2017. All rights reserved.