public class MethodUtil extends Object
| Constructor and Description |
|---|
MethodUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Invoker |
createArrayElementInvoker(Object[] arr)
创建一个数组元素获取执行者
|
static Invoker |
createListElementInvoker(List<?> list)
创建一个集合元素获取执行者
|
static Invoker |
createMethodInvoker(Object obj,
Object[] args,
Method method)
创建一个方法执行者
|
static Invoker |
createNullMethodInvoker(Object nullValue)
创建一个方法为空的方法执行者,代表没有方法,将会输出指定的字符串
|
static Object |
eval(String str)
js中的eval函数,应该是只能进行简单的计算
利用js脚本完成
|
static Object |
evalCache(String str)
js中的eval函数,应该是只能进行简单的计算
利用js脚本完成
|
static List<Method> |
getOriginal(List<Method> methods)
Filter out the Object Methods
过滤掉Object中继承来的方法 |
static Object |
invoke(Object obj,
Object[] args,
Method method)
执行一个方法,可以为基本的数据类型进行转化
|
static Object |
invoke(Object obj,
Object[] args,
String methodName)
执行一个方法,可以为基本的数据类型进行转化
|
public static Object invoke(Object obj, Object[] args, Method method) throws InvocationTargetException, IllegalAccessException
obj - args - method - InvocationTargetExceptionIllegalAccessExceptionpublic static Object invoke(Object obj, Object[] args, String methodName) throws NoSuchMethodException
obj - args - methodName - 方法名NoSuchMethodExceptionpublic static List<Method> getOriginal(List<Method> methods)
methods - 需要过滤的方法列表public static Object eval(String str) throws ScriptException
str - 需要进行eval执行的函数ScriptExceptionpublic static Object evalCache(String str)
str - 需要进行eval执行的函数public static Invoker createMethodInvoker(Object obj, Object[] args, Method method)
public static Invoker createNullMethodInvoker(Object nullValue)
public static Invoker createArrayElementInvoker(Object[] arr)
arr - Copyright © 2024. All rights reserved.