use of com.rebuild.core.RebuildException in project rebuild by getrebuild.
the class CommonsUtils method invokeMethod.
/**
* @param desc
* @param args
* @return
*/
public static Object invokeMethod(String desc, Object... args) {
String[] classAndMethod = desc.split("#");
try {
Class<?> clazz = Class.forName(classAndMethod[0]);
Class<?>[] paramTypes = new Class<?>[args.length];
for (int i = 0; i < args.length; i++) {
paramTypes[i] = args[i].getClass();
}
Method method = clazz.getMethod(classAndMethod[1], paramTypes);
return method.invoke(null, args);
} catch (ReflectiveOperationException ex) {
log.error("Invalid method invoke : {}", desc);
throw new RebuildException(ex);
}
}
Aggregations