cn.cliveyuan.robin.generator.util.ReflectUtils Maven / Gradle / Ivy
package cn.cliveyuan.robin.generator.util;
/**
* 反射工具类
*
* @author Clive Yuan
* @date 2020/11/05
*/
public class ReflectUtils {
/**
* 初始化
*
* @param clazz 类
* @param 泛型
* @return
*/
public static T newInstance(Class> clazz) {
try {
return (T)clazz.getDeclaredConstructor().newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}