ecology_maven/weaver/aiyh_pcn/async_organization/util/GetModelValue.java

21 lines
542 B
Java
Raw Normal View History

2021-11-14 15:29:16 +08:00
package weaver.aiyh_pcn.async_organization.util;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* @author EBU7-dev1-ayh
* @create 2021/7/26 0026 8:55
* model
*/
public class GetModelValue<T> {
public Object getValueForString(T obj, String mothodName) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
Class<?> clazz = obj.getClass();
Method getValue = clazz.getDeclaredMethod("get" + mothodName);
return getValue.invoke(obj);
}
}