net.rim.device.api.command.registrar
Class CommandRequest

java.lang.Object
  extended by net.rim.device.api.command.registrar.CommandRequest

public final class CommandRequest
extends Object

Defines a request to obtain commands from a command registry.

Since:
BlackBerry API 6.0.0

Constructor Summary
CommandRequest()
          Creates a CommandRequest instance.
CommandRequest(String commandId)
          Creates a CommandRequest instance with a specified command identifier.
CommandRequest(CategoryCollection commandCategories)
          Creates a CommandRequest instance containing specified command categories.
CommandRequest(CategoryCollection commandCategories, CategoryCollection contextCategories)
          Create a CommandRequest instance containing specified command categories and context categories.
 
Method Summary
 CategoryCollection getCommandCategories()
          Returns the command categories.
 String getCommandId()
          Returns the command identifier.
 Object getContext()
          Returns the context object.
 CategoryCollection getContextCategories()
          Returns the context categories.
 boolean isAndContextCategories()
          Determines whether the command registrar will logically AND the context categories when searching for commands.
 void setAndContextCategories(boolean andContextCategories)
          Sets whether the command registrar should logically AND the context categories when searching for commands, that is, return commands only if they match all context categories.
 void setCommandCategories(CategoryCollection categories)
          Sets the command categories to query.
 void setCommandId(String commandId)
          Sets the command identifier to query.
 void setContext(Object context)
          Sets the context that is planned to be passed to the retrieved command(s).
 void setContextCategories(CategoryCollection categories)
          Sets the context categories to query.
 String toString()
          Returns a string representation of the instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 



Constructor Detail

CommandRequest

public CommandRequest()
Creates a CommandRequest instance.

Since:
BlackBerry API 6.0.0

CommandRequest

public CommandRequest(CategoryCollection commandCategories)
Creates a CommandRequest instance containing specified command categories.

Parameters:
commandCategories - Command categories to query.
Since:
BlackBerry API 6.0.0

CommandRequest

public CommandRequest(CategoryCollection commandCategories,
                      CategoryCollection contextCategories)
Create a CommandRequest instance containing specified command categories and context categories.

Parameters:
commandCategories - Command categories to query.
contextCategories - Context categories to query.
Since:
BlackBerry API 6.0.0

CommandRequest

public CommandRequest(String commandId)
Creates a CommandRequest instance with a specified command identifier.

Parameters:
commandId - Identifier of the command to query.
Since:
BlackBerry API 6.0.0


Method Detail

setCommandId

public void setCommandId(String commandId)
Sets the command identifier to query.

Parameters:
commandId - The command identifier.
Since:
BlackBerry API 6.0.0

getCommandId

public String getCommandId()
Returns the command identifier.

Returns:
The command identifier. Returns null if no command identifier has been set for this request.
Since:
BlackBerry API 6.0.0

setContext

public void setContext(Object context)
Sets the context that is planned to be passed to the retrieved command(s). If the context object is not null, the command registrar's getCommand() and getCommands() methods will only return commands whose canExecute() method returns true.

Parameters:
context - The context object.
Since:
BlackBerry API 6.0.0

getContext

public Object getContext()
Returns the context object.

Returns:
The context object. Returns null if no context object has been set for this request.
Since:
BlackBerry API 6.0.0

setCommandCategories

public void setCommandCategories(CategoryCollection categories)
Sets the command categories to query.

Parameters:
categories - The command categories.
Since:
BlackBerry API 6.0.0

getCommandCategories

public CategoryCollection getCommandCategories()
Returns the command categories.

Returns:
The Command categories. Never returns null. If no command categories have been set for the request, returns a NullCategoryCollection singleton instance.
Since:
BlackBerry API 6.0.0

setContextCategories

public void setContextCategories(CategoryCollection categories)
Sets the context categories to query.

Parameters:
categories - The context categories.
Since:
BlackBerry API 6.0.0

getContextCategories

public CategoryCollection getContextCategories()
Returns the context categories.

Returns:
The context categories. Never returns null. If no context categories have been set for the request, returns a NullCategoryCollection singleton instance.
Since:
BlackBerry API 6.0.0

setAndContextCategories

public void setAndContextCategories(boolean andContextCategories)
Sets whether the command registrar should logically AND the context categories when searching for commands, that is, return commands only if they match all context categories.

Parameters:
andContextCategories - Indicates whether the command registrar should return commands only if they match all context categories.
Since:
BlackBerry API 6.0.0

isAndContextCategories

public boolean isAndContextCategories()
Determines whether the command registrar will logically AND the context categories when searching for commands. If CommandRequest.setAndContextCategories(boolean) has never been called, returns true.

Returns:
true if context categories are to be ANDed, false otherwise.
Since:
BlackBerry API 6.0.0

toString

public String toString()
Returns a string representation of the instance.

Overrides:
toString in class Object
Returns:
A string representation of the instance.
Since:
BlackBerry API 6.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.