|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.command.CommandMetadata
public class CommandMetadata
Encapsulates metadata associated with a CommandHandler
.
The only required piece of metadata for a command is the command's
identifier, which is set when the CommandMetadata
object is
constructed and is stored in the CommandMetadata.COMMAND_ID
field.
For more information about using this class, see the package overview.
Field Summary | ||
---|---|---|
static String |
ALIGNMENT
The alignment used by the command. |
|
static String |
BITMAP_ICON
The bitmap icon of the command. |
|
static String |
CLASSNAME
The command's class name. |
|
static String |
COMMAND_ID
The identifier of the command. |
|
static String |
LABEL
The label of the command. |
|
static String |
LABEL_ORIENTATION
The orientation of the command's label. |
|
static String |
LABEL_RESOURCE_ID
The identifier of the command's label. |
|
static String |
PREDEFINED_ICON
The predefined icon of the command. |
|
static String |
RESOURCE_BUNDLE_NAME
The name of the resource bundle used by the command. |
|
static String |
THEMED_ICON
The themed icon of the command. |
Constructor Summary | ||
---|---|---|
CommandMetadata(String commandId)
Constructs a new CommandMetadata instance. |
||
CommandMetadata(CommandMetadata metadata)
Constructs a new CommandMetadata instance based on an
existing CommandMetadata instance. |
Method Summary | ||
---|---|---|
void |
addCommandCategory(String commandCategory)
Adds a command category to the command categories for the associated command. |
|
void |
addContextCategory(String contextCategory)
Adds a context category to the context categories for the associated command. |
|
boolean |
getBoolean(String name)
Retrieves the value associated with the specified attribute name as a boolean value. |
|
String |
getClassname()
Retrieves the command's class name. |
|
CategoryCollection |
getCommandCategories()
Retrieves the command categories for the associated command. |
|
String |
getCommandId()
Retrieves the command's identifier (the value stored in CommandMetadata.COMMAND_ID ). |
|
CategoryCollection |
getContextCategories()
Retrieves the context categories for the associated command. |
|
ExecutionContextEnum |
getExecutionContext()
Retrieves the execution context of the associated command. |
|
int |
getInt(String name)
Retrieves the value associated with the specified attribute name as an int value. |
|
long |
getLong(String name)
Retrieves the value associated with the specified attribute name as a long value. |
|
String |
getResourceBundleName()
Retrieves the name of the command's resource bundle (the value stored in CommandMetadata.RESOURCE_BUNDLE_NAME ). |
|
String |
getString(String name)
Retrieves the value associated with the specified attribute name as a string. |
|
boolean |
has(String name)
Determines if this metadata instance contains a specified attribute name. |
|
boolean |
optBoolean(String name)
Retrieves the value associated with the specified attribute name as a boolean value. |
|
boolean |
optBoolean(String name,
boolean defaultValue)
Retrieves the value associated with the specified attribute name as a boolean value. |
|
int |
optInt(String name)
Retrieves the value associated with the specified attribute name as an int value. |
|
int |
optInt(String name,
int defaultValue)
Retrieves the value associated with the specified attribute name as an int value. |
|
long |
optLong(String name)
Retrieves the value associated with the specified attribute name as a long value. |
|
long |
optLong(String name,
long defaultValue)
Retrieves the value associated with the specified attribute name as a long value. |
|
String |
optString(String name)
Retrieves the value associated with the specified attribute name as a string. |
|
String |
optString(String name,
String defaultValue)
Retrieves the value associated with the specified attribute name as a string. |
|
void |
set(String name,
boolean value)
Stores an attribute name and boolean value in this metadata
instance. |
|
void |
set(String name,
int value)
Stores an attribute name and int value in this metadata
instance. |
|
void |
set(String name,
String value)
Stores an attribute name and string value in this metadata instance. |
|
void |
set(String name,
long value)
Stores an attribute name and long value in this metadata
instance. |
|
void |
setClassname(String classname)
Sets the class name of the command. |
|
void |
setCommandCategories(CategoryCollection commandCategories)
Sets the command categories for the associated command. |
|
void |
setContextCategories(CategoryCollection contextCategories)
Sets the context categories for the associated command. |
|
void |
setExecutionContext(ExecutionContextEnum executionContext)
Sets the execution context of the associated command. |
|
void |
setResourceBundleName(String resourceBundleName)
Sets the name of the command's resource bundle (the value stored in CommandMetadata.RESOURCE_BUNDLE_NAME ). |
|
String |
toString()
Retrieves a string representation of this metadata instance. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String COMMAND_ID
public static final String CLASSNAME
public static final String RESOURCE_BUNDLE_NAME
public static final String LABEL_RESOURCE_ID
public static final String LABEL
public static final String LABEL_ORIENTATION
public static final String THEMED_ICON
public static final String PREDEFINED_ICON
public static final String ALIGNMENT
public static final String BITMAP_ICON
Constructor Detail |
---|
public CommandMetadata(String commandId)
CommandMetadata
instance.
commandId
- The identifier of the command that this
CommandMetadata
instance is associated with.public CommandMetadata(CommandMetadata metadata)
CommandMetadata
instance based on an
existing CommandMetadata
instance.
This constructor performs a shallow copy of the metadata of the
specified CommandMetadata
, except for the command categories
and context categories, each of which are deep copied.
metadata
- The CommandMetadata
instance to clone.Method Detail |
---|
public String getCommandId()
CommandMetadata.COMMAND_ID
).
public String getClassname()
public void setClassname(String classname)
classname
- The command's class name.public String getResourceBundleName()
CommandMetadata.RESOURCE_BUNDLE_NAME
).
public void setResourceBundleName(String resourceBundleName)
CommandMetadata.RESOURCE_BUNDLE_NAME
).
resourceBundleName
- The name of the resource bundle.public ExecutionContextEnum getExecutionContext()
CommandMetadata.setExecutionContext(net.rim.device.api.command.ExecutionContextEnum)
public void setExecutionContext(ExecutionContextEnum executionContext)
The value of the execution context instructs the command registrar to execute the command in an execution context other than the current thread (for example, in the process that registered the command).
executionContext
- The execution context.public CategoryCollection getCommandCategories()
null
. If no command categories have been set for the
associated command, this method returns a NullCategoryCollection
singleton instance.public void setCommandCategories(CategoryCollection commandCategories)
commandCategories
- The command categories. If null
,
this method sets the command categories to a
NullCategoryCollection
singleton instance.public void addCommandCategory(String commandCategory)
commandCategory
- The command category to add.public CategoryCollection getContextCategories()
null
. If no context categories have been set for the
associated command, this method returns a NullCategoryCollection
singleton instance.public void setContextCategories(CategoryCollection contextCategories)
contextCategories
- The context categories. If null
,
this method sets the context categories to a
NullCategoryCollection
singleton instance.public void addContextCategory(String contextCategory)
contextCategory
- The context category to add.public boolean has(String name)
name
- The metadata attribute name to check.
true
if this metadata instance contains the
specified name, false
otherwise.public void set(String name, String value)
name
- The name of the attribute.value
- The value of the attribute.public String getString(String name) throws CommandMetadataException
name
- The name of the attribute.
CommandMetadataException
- if the value associated with
name
is not a string.
NonExistentAttributeException
- if an attribute with the specified
name does not exist in this metadata instance.public String optString(String name)
name
- The name of the attribute.
null
if an attribute
with the specified name does not exist in this metadata instance.public String optString(String name, String defaultValue)
name
- The name of the attribute.defaultValue
- The default value of the attribute.
defaultValue
if an
attribute with the specified name does not exist in this metadata
instance.public void set(String name, long value)
long
value in this metadata
instance.
name
- The name of the attribute.value
- The value of the attribute.public long getLong(String name) throws CommandMetadataException
long
value.
name
- The name of the attribute.
CommandMetadataException
- if name
is not a
long
value.
NonExistentAttributeException
- if an attribute with the specified
name does not exist in this metadata instance.public long optLong(String name, long defaultValue)
long
value.
name
- The name of the attribute.defaultValue
- The default value of the attribute.
defaultValue
if an
attribute with the specified name does not exist in this metadata
instance.public long optLong(String name)
long
value.
name
- The name of the attribute.
null
if an attribute
with the specified name does not exist in this metadata instance.public void set(String name, int value)
int
value in this metadata
instance.
name
- The name of the attribute.value
- The value of the attribute.public int getInt(String name) throws CommandMetadataException
int
value.
name
- The name of the attribute.
CommandMetadataException
- if name
is not an
int
value.
NonExistentAttributeException
- if an attribute with the specified
name does not exist in this metadata instance.public int optInt(String name, int defaultValue)
int
value.
name
- The name of the attribute.defaultValue
- The default value of the attribute.
defaultValue
if an
attribute with the specified name does not exist in this metadata
instance.public int optInt(String name)
int
value.
name
- The name of the attribute.
null
if an attribute
with the specified name does not exist in this metadata instance.public void set(String name, boolean value)
boolean
value in this metadata
instance.
name
- The name of the attribute.value
- The value of the attribute.public boolean getBoolean(String name) throws CommandMetadataException
boolean
value.
name
- The name of the attribute.
CommandMetadataException
- if name
is not a
boolean
value.
NonExistentAttributeException
- if an attribute with the specified
name does not exist in this metadata instance.public boolean optBoolean(String name, boolean defaultValue)
boolean
value.
name
- The name of the attribute.defaultValue
- The default value of the attribute.
defaultValue
if an
attribute with the specified name does not exist in this metadata
instance.public boolean optBoolean(String name)
boolean
value.
name
- The name of the attribute.
false
if an attribute
with the specified name does not exist in this metadata instance.public String toString()
toString
in class Object
|
|||||||||
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