package cn.workcenter.common;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
*
* 反射加载类
*
* @author luoy
*
*/
public class Loader {
@SuppressWarnings("rawtypes")
public static Class getClass(String clazz) throws ClassNotFoundException, NoSuchMethodException, SecurityException {
try {
return getTCL().loadClass(clazz);
} catch (ClassNotFoundException | IllegalAccessException
| IllegalArgumentException | InvocationTargetException e) {
e.printStackTrace();
}
return Class.forName(clazz);
}
protected static ClassLoader getTCL() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
Method method = null;
method = Thread.class.getMethod("getContextClassLoader", null);
return (ClassLoader)method.invoke(Thread.currentThread(), null);
}
}
最近下载更多
凡人 LV2
2021年6月23日
sunnvig LV2
2020年7月13日
q1147070520 LV1
2020年4月27日
qq420100523 LV1
2020年3月29日
Kevin_ZC LV4
2020年3月28日
skipple3 LV39
2020年2月26日
111222333444555 LV2
2019年9月3日
Justice_Eternal LV14
2019年8月31日
青春撕扯流年 LV8
2019年8月26日
forest9426 LV2
2019年7月26日
最近浏览更多
guviva LV6
2024年9月30日
15719908287 LV10
2024年6月19日
asddwh LV13
2023年12月29日
yyh1252 LV8
2023年11月16日
liuyong_tom
2023年6月8日
暂无贡献等级
微信网友_6502065173204992 LV1
2023年6月2日
996171721 LV7
2023年5月29日
yangxb2 LV10
2022年10月27日
qq1176648922 LV6
2022年10月24日
youwuzuichen LV11
2022年9月9日

