import java.lang.reflect.Method;
public class ReflectionUtil {
public static void invokeMethod(Object obj, String methodName) throws Exception {
Class<?> clazz = obj.getClass();
Method method = clazz.getMethod(methodName);
if (method == null) {
throw new NoSuchMethodException(methodName);
}
method.invoke(obj);
}
}