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