Call a method of an object
import java.lang.reflect.Method; /** * Handy reflection routines. */ public abstract class Reflect { /** * Call a method of an object. */ public static Object callMethod (Object obj, String methodName, Class[] signature, Object[] args) throws Exception { Class cls = obj.getClass (); Method method = cls.getMethod (methodName, signature); return method.invoke (obj, args); } }