|
|||||||||
| 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 |
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)
Creates an instance of CommandMetadata. |
||
CommandMetadata(CommandMetadata metadata)
Creates an instance of CommandMetadata
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)
Returns the value associated with a specified attribute name as a boolean. |
|
String |
getClassname()
Returns the command's class name. |
|
CategoryCollection |
getCommandCategories()
Returns the command categories for the associated command. |
|
String |
getCommandId()
Returns the command's identifier (the value stored in CommandMetadata.COMMAND_ID). |
|
CategoryCollection |
getContextCategories()
Returns the context categories for the associated command. |
|
ExecutionContextEnum |
getExecutionContext()
Returns the execution context of the associated command. |
|
int |
getInt(String name)
Returns the value associated with a specified attribute name as an int. |
|
long |
getLong(String name)
Returns the value associated with a specified attribute name as a long. |
|
String |
getResourceBundleName()
Returns the name of the command's resource bundle (the value stored in CommandMetadata.RESOURCE_BUNDLE_NAME). |
|
String |
getString(String name)
Returns the value associated with a specified attribute name as a string. |
|
boolean |
has(String name)
Determines if the metadata instance contains a specified attribute name. |
|
boolean |
optBoolean(String name)
Returns the value associated with a specified attribute name as a boolean. |
|
boolean |
optBoolean(String name,
boolean defaultValue)
Returns the value associated with a specified attribute name as a boolean. |
|
int |
optInt(String name)
Returns the value associated with a specified attribute name as a int. |
|
int |
optInt(String name,
int defaultValue)
Returns the value associated with a specified attribute name as a int. |
|
long |
optLong(String name)
Returns the value associated with a specified attribute name as a long. |
|
long |
optLong(String name,
long defaultValue)
Returns the value associated with a specified attribute name as a long. |
|
String |
optString(String name)
Returns the value associated with a specified attribute name as a string. |
|
String |
optString(String name,
String defaultValue)
Returns the value associated with a specified attribute name as a string. |
|
void |
set(String name,
boolean value)
Stores an attribute name and boolean value in the metadata instance. |
|
void |
set(String name,
int value)
Stores an attribute name and int value in the metadata instance. |
|
void |
set(String name,
String value)
Stores an attribute name and string value in the metadata instance. |
|
void |
set(String name,
long value)
Stores an attribute name and long value in the 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()
Returns a string representation of the 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 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.
commandId - Identifier of the command that the instance is associated with.public CommandMetadata(CommandMetadata metadata)
CommandMetadata
based on an existing CommandMetadata instance.
This constructor does a shallow copy of the metadata, except for the command categories and context categories, each of which are deep copied.
metadata - 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, returns a NullCategoryCollection singleton instance.public void setCommandCategories(CategoryCollection commandCategories)
commandCategories - The command categories.
If null, 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, returns a NullCategoryCollection singleton instance.public void setContextCategories(CategoryCollection contextCategories)
contextCategories - The context categories.
If null, sets the context categories to a
NullCategoryCollection singleton instance.public void addContextCategory(String contextCategory)
contextCategory - Context category to add.public boolean has(String name)
name - Metadata attribute name to check.
true if the metadata instance contains the specified name, false otherwise.
public void set(String name,
String value)
name - Name of the attribute.value - Value of the attribute.
public String getString(String name)
throws CommandMetadataException
name - 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 the instance.public String optString(String name)
name - Name of the attribute.
null if an attribute with the specified name does not exist in the metadata instance.
public String optString(String name,
String defaultValue)
name - Name of the attribute.defaultValue - Default value.
defaultValue if an attribute with the specified name does not exist in the instance.
public void set(String name,
long value)
name - Name of the attribute.value - Value of the attribute.
public long getLong(String name)
throws CommandMetadataException
name - Name of the attribute.
CommandMetadataException - if name is not a long.
NonExistentAttributeException - if an attribute with the specified name does not exist in the instance.
public long optLong(String name,
long defaultValue)
name - Name of the attribute.defaultValue - Default value.
defaultValue if an attribute with the specified name does not exist in the instance.public long optLong(String name)
name - Name of the attribute.
null if an attribute with the specified name does not exist in the metadata instance.
public void set(String name,
int value)
name - Name of the attribute.value - Value of the attribute.
public int getInt(String name)
throws CommandMetadataException
name - Name of the attribute.
CommandMetadataException - if name is not an int.
NonExistentAttributeException - if an attribute with the specified
name does not exist in the instance.
public int optInt(String name,
int defaultValue)
name - Name of the attribute.defaultValue - Default value.
defaultValue if an attribute with the specified name does not exist in the instance.public int optInt(String name)
name - Name of the attribute.
null if an attribute with the specified name does not exist in the metadata instance.
public void set(String name,
boolean value)
name - Name of the attribute.value - Value of the attribute.
public boolean getBoolean(String name)
throws CommandMetadataException
name - Name of the attribute.
CommandMetadataException - if name is not a boolean.
NonExistentAttributeException - if an attribute with the specified
name does not exist in the instance.
public boolean optBoolean(String name,
boolean defaultValue)
name - Name of the attribute.defaultValue - Default value.
defaultValue if an attribute with the specified name does not exist in the metadata instance.public boolean optBoolean(String name)
name - Name of the attribute.
false if an attribute with the specified name does not exist in the 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-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.