net.rim.device.api.command
Class CommandHandler

java.lang.Object
  extended by net.rim.device.api.command.CommandHandler
Direct Known Subclasses:
AlwaysExecutableCommand, NullCommandHandler

public abstract class CommandHandler
extends Object

Defines the work that a command performs.

For more information about using this class, see the package overview.

Since:
BlackBerry API 6.0.0

Constructor Summary
CommandHandler()
          Create a CommandHandler instance.
 
Method Summary
 boolean canExecute(ReadOnlyCommandMetadata metadata, Object context)
          Determines whether a call to execute() is valid using the passed-in context object.
abstract  void execute(ReadOnlyCommandMetadata metadata, Object context)
          Implementations of this method can ignore the passed-in context object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

CommandHandler

public CommandHandler()
Create a CommandHandler instance.

Since:
BlackBerry API 6.0.0


Method Detail

execute

public abstract void execute(ReadOnlyCommandMetadata metadata,
                             Object context)
Implementations of this method can ignore the passed-in context object.

Parameters:
metadata - Metadata that the CommandHandler was registered with. Cannot be modified.
context - External state information.
Since:
BlackBerry API 6.0.0

canExecute

public boolean canExecute(ReadOnlyCommandMetadata metadata,
                          Object context)
Determines whether a call to execute() is valid using the passed-in context object. Implementations of this method can ignore the passed-in context object.

Note: Calling this method for CommandHandler instances retrieved from RemoteCommandRegistrarConnection always returns true. This is because of performance concerns when looping over a list of command handlers and potentially calling this method in different processes.

Parameters:
metadata - Metadata that the CommandHandler was registered with. Cannot be modified.
context - External state information.
Returns:
true if the execute() method can be called, false otherwise.
Since:
BlackBerry API 6.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal