|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.command.Command
public final class Command
Executes a command. You can think of a Command
instance as a
proxy to an instance of CommandHandler
. It binds an instance of CommandHandler
with an associated CommandMetadata
instance.
For more information about using this class, see the package overview.
Constructor Summary | ||
---|---|---|
Command(CommandHandler commandHandler)
Creates a Command instance using a passed-in CommandHandler . |
||
Command(CommandHandler commandHandler,
CommandMetadata metadata)
Creates a Command instance using a passed-in CommandHandler and CommandMetadata . |
||
Command(CommandHandler commandHandler,
ReadOnlyCommandMetadata metadata)
Creates a Command instance using a passed-in CommandHandler and ReadOnlyCommandMetadata . |
||
Command(CommandMetadata metadata)
Creates a Command instance using a passed-in CommandMetadata . |
Method Summary | ||
---|---|---|
boolean |
canExecute(Object context)
Determines whether a call to execute() is valid using a passed-in context object. |
|
void |
execute(Object context)
Executes the command using a passed-in context object. |
|
String |
getId()
Returns the command's identifier. |
|
ReadOnlyCommandMetadata |
getMetadata()
Returns the command's metadata. |
|
StringProvider |
getStringResource(int resourceId)
Returns the localized string resource associated with a specified resource identifier. |
|
StringProvider |
getStringResource(String metadataId)
Returns the localized string resource associated with a specified metadata identifier. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Command(CommandHandler commandHandler)
Command
instance using a passed-in CommandHandler
.
commandHandler
- The CommandHandler
to delegate to for the execute()
and canExecute()
methods.public Command(CommandHandler commandHandler, CommandMetadata metadata)
Command
instance using a passed-in CommandHandler
and CommandMetadata
.
commandHandler
- The CommandHandler
to delegate to for the execute()
and canExecute()
methods.metadata
- The command's metadata instance.public Command(CommandHandler commandHandler, ReadOnlyCommandMetadata metadata)
Command
instance using a passed-in CommandHandler
and ReadOnlyCommandMetadata
.
commandHandler
- The CommandHandler
to delegate to for the execute()
and canExecute()
methods.metadata
- The command's metadata instance.public Command(CommandMetadata metadata)
Command
instance using a passed-in CommandMetadata
.
metadata
- The command's metadata instance.Method Detail |
---|
public boolean canExecute(Object context)
execute()
is valid using a passed-in context object.
Implementations of this method can ignore the passed-in context object.
context
- External state information.
true
if the execute()
method can be called, false
otherwise.public void execute(Object context)
context
- External state information.public ReadOnlyCommandMetadata getMetadata()
null
.public String getId()
null
.public StringProvider getStringResource(String metadataId)
If the method call is invalid for any reason, a non-null StringProvider
will be returned
whose toString()
method returns null
.
StringProvider
instances created as a result of calling this method will be cached
by this instance.
metadataId
- The metadata identifier. Should be contained in the associated metadata instance's resource bundle.
null
.CommandMetadata.RESOURCE_BUNDLE_NAME
public StringProvider getStringResource(int resourceId)
If the method call is invalid for any reason, a non-null StringProvider
will be returned
whose toString()
method returns null
.
StringProvider
instances created as a result of calling this method will be cached
by this instance.
resourceId
- The resource identifier.
null
.CommandMetadata.RESOURCE_BUNDLE_NAME
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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