首页>代码>java web网页版redis客户端工具>/redis-admin/src/main/java/cn/workcenter/common/Loader.java
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日
最近浏览更多
asddwh  LV12 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  LV10 2022年9月9日
小橘子1640  LV3 2022年5月31日
mwh1001  LV15 2022年5月11日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友