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:
@@ -3,11 +3,11 @@ package pm.application;
|
||||
import pm.action.Action;
|
||||
|
||||
public abstract class Application {
|
||||
public void invoke(Action action) {
|
||||
switch (action) {
|
||||
case START:
|
||||
start();
|
||||
break;
|
||||
public void invoke(Action action) throws Exception {
|
||||
try {
|
||||
action.getMethod(this).invoke(this);
|
||||
} catch (Exception e) {
|
||||
throw new Exception("Failed to invoke action");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user