Omslachtigheid van actions en type in event omgeschreven naar action enum met parameter voor type. Type hernoemd naar target, dat dekt de lading beter. Mogelijkheid om ook device als target te gebruiken? En op die manier feedback versturen? Het event is nu bedoeld om events van services naar de devices te versturen.

This commit is contained in:
2011-02-04 21:23:01 +00:00
parent df91eab859
commit 1c61ac62fd
11 changed files with 77 additions and 60 deletions

View File

@@ -2,6 +2,7 @@ package pm.action;
import java.lang.reflect.Method;
import pm.event.Target;
import pm.exception.ActionNotImplementedException;
public enum Action {
@@ -10,11 +11,20 @@ public enum Action {
EXIT ("exit");
protected String action;
protected Target target;
Action(String action) {
this.action = action;
}
public void setTarget(Target target) {
this.target = target;
}
public Target getTarget() {
return target;
}
public Method getMethod(Object object) throws ActionNotImplementedException {
try {
return object.getClass().getMethod(action);