程序包 org.xmeta.util
类 UtilJava
- java.lang.Object
-
- org.xmeta.util.UtilJava
-
public class UtilJava extends Object
Java相关的一些工具类。- 作者:
- Administrator
-
-
构造器概要
构造器 构造器 说明 UtilJava()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static Constructor<?>getConstructor(Class<?> cls, Object... objects)根据参数获取相应的构造函数。static <T> Iterable<T>getIterable(Object collection)把指定对象转换成Iterable,如果是数据或Iterable本身的条目也是返回的Iteralbe的条目, null返回一个空List,其他包装成一个Iterable,把对象放到Iterable条目中。static <T> Iterator<T>getIterator(Object collection)static MethodgetMethod(Class<?> cls, String methodName, List<Object> params)通过参数值列表获取对象的方法。static ObjectinvokeMethod(String className, String methodName, Class<?>[] paramTypes, Object[] args)调用参数是ActionContext的静态方法。static ObjectinvokeMethod(String className, String methodName, ActionContext actionContext)调用参数是ActionContext的静态方法。static <T> TnewInstance(String className, Object... objects)一个简单的实例化对象的方法。
-
-
-
方法详细资料
-
getIterable
public static <T> Iterable<T> getIterable(Object collection)
把指定对象转换成Iterable,如果是数据或Iterable本身的条目也是返回的Iteralbe的条目, null返回一个空List,其他包装成一个Iterable,把对象放到Iterable条目中。- 参数:
collection- 集合- 返回:
- 可遍历对象
-
getMethod
public static Method getMethod(Class<?> cls, String methodName, List<Object> params)
通过参数值列表获取对象的方法。- 参数:
cls- 类methodName- 方法名称params- 参数- 返回:
- 方法
-
invokeMethod
public static Object invokeMethod(String className, String methodName, ActionContext actionContext) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, ClassNotFoundException
调用参数是ActionContext的静态方法。- 参数:
className- 类名methodName- 方法名actionContext- 变量上下文- 返回:
- 方法的执行结果
- 抛出:
InvocationTargetExceptionIllegalArgumentExceptionIllegalAccessExceptionSecurityExceptionNoSuchMethodExceptionClassNotFoundException
-
invokeMethod
public static Object invokeMethod(String className, String methodName, Class<?>[] paramTypes, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, ClassNotFoundException
调用参数是ActionContext的静态方法。- 参数:
className- 类名methodName- 方法名paramTypes- 参数类型args- 参数列表- 返回:
- 方法的执行结果
- 抛出:
InvocationTargetExceptionIllegalArgumentExceptionIllegalAccessExceptionSecurityExceptionNoSuchMethodExceptionClassNotFoundException
-
newInstance
public static <T> T newInstance(String className, Object... objects) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
一个简单的实例化对象的方法。- 参数:
className- 类名objects- 参数列表- 返回:
- 抛出:
ClassNotFoundExceptionInvocationTargetExceptionIllegalArgumentExceptionIllegalAccessExceptionInstantiationException
-
getConstructor
public static Constructor<?> getConstructor(Class<?> cls, Object... objects)
根据参数获取相应的构造函数。- 参数:
cls-objects-- 返回:
- 构造函数
-
-