com.miginfocom.util.command
Class DefaultCommand

java.lang.Object
  extended by com.miginfocom.util.command.AbstractCommand
      extended by com.miginfocom.util.command.DefaultCommand
All Implemented Interfaces:
Command, CommandSet, java.io.Serializable

public class DefaultCommand
extends AbstractCommand
implements CommandSet

A generic command that can be interpreted by any class. The values of the different fields in the command is a loose contract between the command specifier and the executor.

See Also:
Interactor, AbstractInteractionBroker, Serialized Form

Constructor Summary
DefaultCommand()
          Constructs a command which has no command string.
DefaultCommand(java.lang.Object id, PropertyKey cmd, PropertyKey property, java.lang.Object value, java.lang.String target)
          Constructor.
DefaultCommand(java.lang.Object id, java.lang.String cmd, java.lang.String property, java.lang.Object value, java.lang.String target)
          Deprecated. For backwards compatibility. Don't use.
DefaultCommand(PropertyKey cmd, PropertyKey property, java.lang.Object value, java.lang.String target)
          Constructor.
DefaultCommand(java.lang.String cmd, java.lang.String property, java.lang.Object value, java.lang.String target)
          Deprecated. For backwards compatibility. Don't use.
 
Method Summary
 boolean equals(java.lang.Object o)
          Compares id.
 java.lang.Object execute()
          Returns null and does nothing.
 PropertyKey getCommandKey()
          Returns the command.
 Command[] getCommands()
          Overridden to return this as the only command.
 PropertyKey getPropertyKey()
          Returns the property.
 java.lang.String getTarget()
          Returns the target name for the command.
 java.lang.Object getValue()
          Return the value that belong to the property.
 java.lang.String toString()
           
 
Methods inherited from class com.miginfocom.util.command.AbstractCommand
createUniqeID, getID, isEnabled, setEnabled
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultCommand

public DefaultCommand()
Constructs a command which has no command string. Brokers and handlers of this command should call execute() if there are no command string.


DefaultCommand

public DefaultCommand(java.lang.String cmd,
                      java.lang.String property,
                      java.lang.Object value,
                      java.lang.String target)
Deprecated. For backwards compatibility. Don't use.

Constructor.


DefaultCommand

public DefaultCommand(PropertyKey cmd,
                      PropertyKey property,
                      java.lang.Object value,
                      java.lang.String target)
Constructor. Autogenerates ID.

Parameters:
cmd - The command.
property - The property name. E.g. "land"
value - The value that belong to the property. E.g. "Sweden"
target - The target name for the command. E.g. "browserSetting"
See Also:
DefaultInteractionBroker

DefaultCommand

public DefaultCommand(java.lang.Object id,
                      java.lang.String cmd,
                      java.lang.String property,
                      java.lang.Object value,
                      java.lang.String target)
Deprecated. For backwards compatibility. Don't use.

Constructor.


DefaultCommand

public DefaultCommand(java.lang.Object id,
                      PropertyKey cmd,
                      PropertyKey property,
                      java.lang.Object value,
                      java.lang.String target)
Constructor.

Parameters:
cmd - The command.
id - The is for this command. Not null.
property - The property.
value - The value that belong to the property. E.g. "Sweden"
target - The target name for the command. E.g. "browserSetting"
See Also:
DefaultInteractionBroker
Method Detail

getCommands

public Command[] getCommands()
Overridden to return this as the only command.

Specified by:
getCommands in interface CommandSet
Returns:
this in an array.

getCommandKey

public PropertyKey getCommandKey()
Returns the command. This can be null and if so the only this that should be done is calling execute().

Returns:
The command.

getPropertyKey

public PropertyKey getPropertyKey()
Returns the property.

Returns:
The property. May be null.

getValue

public java.lang.Object getValue()
Return the value that belong to the property.

Returns:
The value that belong to the property. May be null.

getTarget

public java.lang.String getTarget()
Returns the target name for the command.

Returns:
The target name for the command. May be null.

execute

public java.lang.Object execute()
Returns null and does nothing.

Specified by:
execute in interface Command
Returns:
null.

equals

public boolean equals(java.lang.Object o)
Description copied from class: AbstractCommand
Compares id.

Overrides:
equals in class AbstractCommand

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.