net.rim.device.api.command
Class ReadOnlyCommandMetadata

java.lang.Object
  extended by net.rim.device.api.command.ReadOnlyCommandMetadata

public class ReadOnlyCommandMetadata
extends Object

Read-only version of CommandMetadata. Note that this class does not extend CommandMetadata. This class decorates a CommandMetadata instance and provides access only to methods that do not mutate it.

Since:
BlackBerry API 6.0.0

Constructor Summary
ReadOnlyCommandMetadata(CommandMetadata metadata)
          Creates a ReadOnlyCommandMetadata instance.
 
Method Summary
 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.
 CategoryCollection getContextCategories()
          Returns the context categories for 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.
 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.
 int hashCode()
          Returns a hash code value for the object.
 boolean optBoolean(String name)
          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.
 String toString()
          Returns a string representation of the instance.
 
Methods inherited from class java.lang.Object
equals, getClass, notify, notifyAll, wait, wait, wait
 



Constructor Detail

ReadOnlyCommandMetadata

public ReadOnlyCommandMetadata(CommandMetadata metadata)
Creates a ReadOnlyCommandMetadata instance.

Parameters:
metadata - CommandMetadata instance to decorate.
Throws:
NullPointerException - if metadata is null.
Since:
BlackBerry API 6.0.0


Method Detail

getBoolean

public boolean getBoolean(String name)
                   throws CommandMetadataException
Returns the value associated with a specified attribute name as a boolean.

Parameters:
name - Name of the attribute.
Returns:
Value of the attribute.
Throws:
CommandMetadataException - if name is not a boolean.
See Also:
CommandMetadata.getBoolean(java.lang.String)
Since:
BlackBerry API 6.0.0

getClassname

public String getClassname()
Returns the command's class name.

Returns:
The command's class name.
See Also:
CommandMetadata.getClassname()
Since:
BlackBerry API 6.0.0

getResourceBundleName

public String getResourceBundleName()
Returns the name of the command's resource bundle.

Returns:
The resource bundle name.
See Also:
CommandMetadata.getResourceBundleName()
Since:
BlackBerry API 6.0.0

getCommandCategories

public CategoryCollection getCommandCategories()
Returns the command categories for the associated command.

Returns:
The command categories.
See Also:
CommandMetadata.getCommandCategories()
Since:
BlackBerry API 6.0.0

getCommandId

public String getCommandId()
Returns the command's identifier.

Returns:
The command's identifier.
See Also:
CommandMetadata.getCommandId()
Since:
BlackBerry API 6.0.0

getContextCategories

public CategoryCollection getContextCategories()
Returns the context categories for the associated command.

Returns:
The context categories.
See Also:
CommandMetadata.getContextCategories()
Since:
BlackBerry API 6.0.0

getInt

public int getInt(String name)
           throws CommandMetadataException
Returns the value associated with a specified attribute name as an int.

Parameters:
name - Name of the attribute.
Returns:
Value of the attribute.
Throws:
CommandMetadataException - if name is not an int.
See Also:
CommandMetadata.getInt(java.lang.String)
Since:
BlackBerry API 6.0.0

getLong

public long getLong(String name)
             throws CommandMetadataException
Returns the value associated with a specified attribute name as a long.

Parameters:
name - Name of the attribute.
Returns:
Value of the aattribute.
Throws:
CommandMetadataException - if name is not a long.
See Also:
CommandMetadata.getLong(java.lang.String)
Since:
BlackBerry API 6.0.0

getString

public String getString(String name)
                 throws CommandMetadataException
Returns the value associated with a specified attribute name as a string.

Parameters:
name - Name of the attribute.
Returns:
Value of the attribute.
Throws:
CommandMetadataException - if the value associated with name is not a string.
See Also:
CommandMetadata.getString(java.lang.String)
Since:
BlackBerry API 6.0.0

has

public boolean has(String name)
Determines if the metadata instance contains a specified attribute name.

Parameters:
name - Metadata attribute name to check.
Returns:
true if the metadata instance contains the specified name, false otherwise.
See Also:
CommandMetadata.has(java.lang.String)
Since:
BlackBerry API 6.0.0

hashCode

public int hashCode()
Description copied from class: Object
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

The general contract of hashCode is:

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.
See Also:
Object.hashCode()
Since:
BlackBerry API 6.0.0

optBoolean

public boolean optBoolean(String name)
Returns the value associated with a specified attribute name as a boolean.

Parameters:
name - Name of the attribute.
Returns:
Value of the attribute. Returns false if an attribute with the specified name does not exist in the metadata instance.
See Also:
CommandMetadata.optBoolean(java.lang.String)
Since:
BlackBerry API 6.0.0

optInt

public int optInt(String name,
                  int defaultValue)
Returns the value associated with a specified attribute name as a int.

Parameters:
name - Name of the attribute.
defaultValue - Default value.
Returns:
Value of the attribute. Returns defaultValue if an attribute with the specified name does not exist in the instance.
See Also:
CommandMetadata.optInt(java.lang.String, int)
Since:
BlackBerry API 6.0.0

optInt

public int optInt(String name)
Returns the value associated with a specified attribute name as a int.

Parameters:
name - Name of the attribute.
Returns:
Value of the attribute. Returns null if an attribute with the specified name does not exist in the metadata instance.
Since:
BlackBerry API 6.0.0

optLong

public long optLong(String name,
                    long defaultValue)
Returns the value associated with a specified attribute name as a long.

Parameters:
name - Name of the attribute.
defaultValue - Default value.
Returns:
Value of the attribute. Returns defaultValue if an attribute with the specified name does not exist in the instance.
See Also:
CommandMetadata.optLong(java.lang.String, long)
Since:
BlackBerry API 6.0.0

optLong

public long optLong(String name)
Returns the value associated with a specified attribute name as a long.

Parameters:
name - Name of the attribute.
Returns:
Value of the attribute. Returns null if an attribute with the specified name does not exist in the metadata instance.
See Also:
CommandMetadata.optLong(java.lang.String)
Since:
BlackBerry API 6.0.0

optString

public String optString(String name,
                        String defaultValue)
Returns the value associated with a specified attribute name as a string.

Parameters:
name - Name of the attribute.
defaultValue - Default value.
Returns:
Value of the attribute. Returns defaultValue if an attribute with the specified name does not exist in the instance.
See Also:
CommandMetadata.optString(java.lang.String, java.lang.String)
Since:
BlackBerry API 6.0.0

optString

public String optString(String name)
Returns the value associated with a specified attribute name as a string.

Parameters:
name - Name of the attribute.
Returns:
Value of the attribute. Returns null if an attribute with the specified name does not exist in the metadata instance.
See Also:
CommandMetadata.optString(java.lang.String)
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.
See Also:
Object.toString()
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.