Nu wordt de methode dynamisch geladen via de enum met een beetje reflectie. Als de methode niet bestaat, worden exceptions gegooid.

This commit is contained in:
2011-02-02 21:02:21 +00:00
parent 83cbde6ec3
commit 65429f1502
4 changed files with 34 additions and 8 deletions

View File

@@ -1,5 +1,18 @@
package pm.action;
import java.lang.reflect.Method;
public enum Action {
START
START ("start"),
TEST ("test");
protected String action;
Action(String action) {
this.action = action;
}
public Method getMethod(Object object) throws Exception {
return object.getClass().getMethod(action);
}
}