Action invoke systeem verbeterd en nette exceptions geintroduceerd.
This commit is contained in:
@@ -2,9 +2,12 @@ package pm.action;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import pm.exception.ActionNotImplementedException;
|
||||
|
||||
public enum Action {
|
||||
START ("start"),
|
||||
TEST ("test");
|
||||
TEST ("test"),
|
||||
EXIT ("exit");
|
||||
|
||||
protected String action;
|
||||
|
||||
@@ -12,7 +15,11 @@ public enum Action {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public Method getMethod(Object object) throws Exception {
|
||||
return object.getClass().getMethod(action);
|
||||
public Method getMethod(Object object) throws ActionNotImplementedException {
|
||||
try {
|
||||
return object.getClass().getMethod(action);
|
||||
} catch (SecurityException e) {
|
||||
} catch (NoSuchMethodException e) {}
|
||||
throw new ActionNotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user