java
Java reflection example.
기계새
2014. 10. 7. 17:53
Class clazz : 클래스 변수
List<String> methodList : 메소드 리스트
Object source : 메소드를 호출할 객체
try {
for (String methodStr : methodInfoList) {
Object result = clazz.getMethod(methodStr).invoke(source);
}
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
log.error("error." + e.getMessage());
throw new Exception("");
}