Is it possible to obtain references to an object’s methods? For example, I’d like to have a method that invokes other methods as callbacks. Something like:
public class Whatever
{
public void myMethod(Method m,Object args[])
{
}
}
Is this possible?
EDIT: I meant an object’s methods. I take it it’s not possible?
Yes, it is possible.
You just have the get the method and invoke it.
Here’s some sample code:
Now the question is, what are you trying to do? perhaps are better ways. But as for your question the answer is YES.