I have functionality that I am encapsulate on diff commands using Command pattern.
I am creating the command with the information and logic it need how ever I am getting
The Command pattern stipulates an object that can be executed with no arguments after its creation (for example: Runnable or Callable) however, there is nothing preventing arguments from being passed during creation; so you can simply move the msg
argument from the execute()
method to the command's constructor.
In a typical use of the Command pattern, commands are created in one place and executed in another. The creation logic is parameterized; the execution logic is not.