Nothing nice. The only method to enable you to do a similar thing is reflection:
public class ReflectionExample {
private static class A {
public void foo() {
System.out.println("fooing A now");
}
}
public static void main(String[] args) throws SecurityException, NoSuchMethodException, IllegalArgumentException,
IllegalAccessException, InvocationTargetException {
Method method = A.class.getMethod("foo");
method.invoke(new A());
}
}
And then you can only call Method.invoke on an object of the same class (or a subclass).
EDIT: To solve your exact problem I think you are probably best creating one class for each command. Each of these classes can implement an interface that will contain the method to perform the command and probably also a String getter for the name of the command. You can then populate a collection with command instances.
The only danger of this method is you add a new command class and forget to create an instance of it. The best method I have found to avoid that is to use an enumeration with one member for each command. To create the instances you can iterate over the enumerations values and use a switch case to create the instances. Some IDEs (such as Eclipse) can generate a warning or error if an enumeration instance is not covered in a switch - that will tell you immediately if you have forgotten to create a command instance.