Action invoke systeem verbeterd en nette exceptions geintroduceerd.

This commit is contained in:
2011-02-03 14:41:12 +00:00
parent 76fdef60be
commit e9a3cd661f
12 changed files with 100 additions and 48 deletions

View File

@@ -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();
}
}