|
Evaluating Software Design Patterns — the "Gang of Four" patterns implemented in Java 6 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.rode.thesis.command.NullCommand<E>
E
- The type of result obtained by executing this command.
This command type always return null as the result.@Participant(value="ConcreteCommand") public class NullCommand<E>
A null command performs no operation on execute
or on undo
, is always considered
undoable
, and carries no state.
Null commands are thread-safe and can be shared.
Constructor Summary | |
---|---|
NullCommand()
No-arg constructor. |
Method Summary | |
---|---|
NullCommand<E> |
copy()
Creates a copy of this command, excluding internal state information required for execution and undo. |
boolean |
equals(Object object)
Returns true if object is an instance
of a NullCommand . |
List<Command<E>> |
execute()
Does nothing. |
E |
getResult()
Returns the result of the execution of this
command. |
int |
hashCode()
Returns the hash code of this null command. |
boolean |
isUndoable()
Returns true. |
String |
toString()
Returns the string representation of this null command. |
E |
undo()
Does nothing. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public NullCommand()
Method Detail |
---|
public NullCommand<E> copy()
Command
copy
in interface Command<E>
copy
in interface Copyable<Command<E>>
public boolean equals(Object object)
object
is an instance
of a NullCommand
.
equals
in class Object
object
- The object to test; can be null.
public List<Command<E>> execute()
execute
in interface Command<E>
Command.undo()
public E getResult()
Command
execution
of this
command.
Invoking this method before execution will cause an illegal
state exception to be thrown. If undone
,
this command must be re-executed before the result can be
fetched again.
getResult
in interface Command<E>
public int hashCode()
hashCode
in class Object
public boolean isUndoable()
isUndoable
in interface Command<E>
public String toString()
toString
in class Object
ObjectPolicy.ID
public E undo()
undo
in interface Command<E>
|
Gunni Rode / rode.dk | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |