I have functionality that I encapsulate on diff commands using the Command pattern.
I create a command with the information and logic that it needs, as soon as I get some parameters only at runtime , I need to provide my commands
eg:
public class sendMessageToServerCommand implements Command {
@Override
public void execute(String msg){
sendToServerTheMsg(msg);
}
}
..
Command command=new sendMessageToServerCommand();
command.execute("msg I got on runtime");
Perhaps I should not use the command template and think about something else? offers?
Thank.
source
share