qflib 0.98.1

de.qfs.lib.command
Class Command

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--de.qfs.lib.command.Command
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AsyncCommand

public class Command
extends java.util.EventObject

Commands are similar to the events of a GUI, but operate at a higher level of abstraction. They can be created anywhere and passed to a CommandDistributor that will either execute them directly or pass them on to suitable CommandHandlers.

Version:
$Revision: 1.6 $
Author:
Gregor Schmid
See Also:
Serialized Form

Fields inherited from class java.util.EventObject
source
 
Constructor Summary
Command(java.lang.Object source)
          Create a new Command object.
 
Method Summary
 boolean isHandled()
          Query whether the Command was already handled.
 boolean mustBeHandled()
          Test whether the Command must be handled.
 void setHandled(boolean handled)
          Set the handled state of the Command.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Command

public Command(java.lang.Object source)
Create a new Command object.
Parameters:
source - The source from which the Command originated.
Method Detail

isHandled

public final boolean isHandled()
Query whether the Command was already handled.
Returns:
The handled state of the Command.

setHandled

public final void setHandled(boolean handled)
Set the handled state of the Command.
Parameters:
handled - The handled state to set.

mustBeHandled

public boolean mustBeHandled()
Test whether the Command must be handled. If true, the CommandDistributor will throw an UnhandledCommandException in assignCommandSilently if it cannot find a handler for the command.

The default is to always return true, but you can override this method in a derived class to signal otherwise, which is useful for message type commands with possibly multiple receivers.

Returns:
True.
Since:
0.98.0

qflib 0.98.1