I had an idea and it goes like this:
- Parse a file on service side.
- Create a list of actions based on the file's contents.
- Pass the list of actions to the client side.
- Have the client define and perform actions based on the items on the list.
As in the visitor pattern, we'd have a class for the actions and all of them inherit the Action interface. The clients would then implement the visitors. In Java it'd be something like this:
public interface Action {
void act(Visitor visitor);
}
public class PerfectAction implements Action {
void act(Visitor visitor) {
visitor.bePerfect();
}
}
public class VisibleAction implements Action {
void act(Visitor visitor) {
visitor.beVisible();
}
}
public interface Visitor {
void bePerfect();
void beVisible();
}
The Problem
I can't create Proxy classes for the Action and Visitor interfaces. They do not contain setters and/or getters. Plus they do not contain any data. Is it possible to pass this knowledge of which method should be called on the Visitor object from service to client side?