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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user