|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Command
A command is a single unit of execution where the calling code is decoupled from the work being performed. In a way, it can be thought of as encapsulating a method into its own object. Instead of passing method parameters, the object is constructed with the appropriate attributes to peform its work. This command is similar to the Command Pattern discussed in the book "Design Patterns", Gamma, et al..
A few modifications have been made to the standard command patterns including the addition of an encapsulated return type and the passing of a CommandEnvironment object on the execute method.
The CommandEnvironment is a way to further decouple a command from its surroundings and makes it easier to transport the command to another location before execution. For example, a client could create a command and send it to a server. The server could then supply a local environment.
One of the primary functions of the CommandEnvironment object is to give the command a means of running its own commands as sub-tasks. By doing this through the environment object, the command doesn't have to have any specific knowledge or reference to a specific command processor. Plus, depending on the command processor architecture, the environment may be specially tailored to the thread or process in which the command has been executed.
Method Summary | |
---|---|
Result |
execute(Environment env)
Called by a command processor to invoke this command's implemented functionality. |
Method Detail |
---|
Result execute(Environment env)
env
- The environment within which the command is running.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |