pdrake
asked on
Arrays of methods
How would you implement an array of methods? I have tried getMethods() & invoke() but can't get that to work. Are there other ways of doing it?
Both class and method are mannaged as pointer internaly, have you tried storing the value for this.method in an array of Objects?
You can make an interface with a single method:
public interface MethodInterface {
public myMethod(String[] args);
}
and then make an array of Objects that implement the method.
MethodInterface[] methodArray = new MethodInterface[10];
public interface MethodInterface {
public myMethod(String[] args);
}
and then make an array of Objects that implement the method.
MethodInterface[] methodArray = new MethodInterface[10];
Take a look at:
http://www.panix.com/~rangerx/packages.html
it has a class library that will probably help a lot.
Let me know if it solves your problem.
http://www.panix.com/~rangerx/packages.html
it has a class library that will probably help a lot.
Let me know if it solves your problem.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This seems a little messy. While I was waiting for an answer I figured out how to implement the array of methods I needed with an interface instead of .reflect and .Class. It's probably less powerful but perfectly satisfies my requirements. Thank you.