Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface Session {
- public void submit(Command cmd);
- }
- interface Queryable {
- public void executeQuery(String query);
- }
- interface Command {
- public void execute(Queryable queryable);
- }
- class SessionImpl implements Session, Queryable {
- public void executeQuery(String query) { // execute query in the current session }
- public void submit(Command cmd) {
- cmd.execute(this);
- }
- }
- class CommandImpl implements Command {
- public void execute(Queryable queryable) {
- queryable.executeQuery("Hello world!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement