javax.microedition.content
Class ActionNameMap

java.lang.Object
  |
  +--javax.microedition.content.ActionNameMap

public final class ActionNameMap
extends Object

An ActionNameMap provides a mapping between actions and corresponding action names. The action name SHOULD be used by an application when the action is presented to a user. The action names in each map apply to a single locale. The application should get the appropriate ActionNameMap based on the desired locale from the method ContentHandler.getActionNameMap. The actions and corresponding action names are set when the ActionNameMap is created and are immutable thereafter. The indices of the actions and action names are in the range 0 to size-1.

Since:
JDE 4.3.0

Constructor Summary
ActionNameMap(String[] actions, String[] actionnames, String locale)
          Create a new map of actions to action names for a locale.
 
Method Summary
 String getAction(int index)
          Gets the action at the specified index.
 String getAction(String actionname)
          Gets the action for the action name.
 String getActionName(int index)
          Gets the action name at the specified index.
 String getActionName(String action)
          Gets the action name for an action.
 String getLocale()
          Gets the locale for this set of action names.
 int size()
          Gets the number of pairs of actions and action names.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionNameMap

public ActionNameMap(String[] actions,
                     String[] actionnames,
                     String locale)
Create a new map of actions to action names for a locale. The actions and names are parallel sequences of equal length. Each action maps to the corresponding action name.
Parameters:
actions - an array of actions; MUST NOT be null
actionnames - an array of action names; MUST NOT be null
locale - of the action names; MUST NOT be null; should be formatted according to the locale syntax conventions in ContentHandler.
Throws:
IllegalArgumentException: -
  • if any of the actions strings or actionname strings have a length of zero,
  • if the length of the actions and actionnames arrays are unequal, or equal to zero, or
  • if the actions array includes any duplicate actions.
NullPointerException - if actions, actionnames, locale, or any array element is null.
Since:
JDE 4.3.0
Method Detail

getAction

public String getAction(int index)
Gets the action at the specified index.
Parameters:
index - the index of the action
Returns:
the action at the specified index
Throws:
IndexOutOfBoundsException - if index is less than zero or greater than or equal to the value of the size method.
Since:
JDE 4.3.0

getAction

public String getAction(String actionname)
Gets the action for the action name. If the action name appears more than once in the sequence, then any one of the corresponding actions may be returned.
Parameters:
actionname - the action name for which to get the associated action; MUST NOT be null
Returns:
the action; null is returned if the actionname is not found in the sequence of action names
Throws:
NullPointerException - if actionname is null
Since:
JDE 4.3.0

getActionName

public String getActionName(int index)
Gets the action name at the specified index.
Parameters:
index - the index of the action name
Returns:
the action name at the specified index
Throws:
IndexOutOfBoundsException - if index is less than zero or greater than or equal to the value of the size method.
Since:
JDE 4.3.0

getActionName

public String getActionName(String action)
Gets the action name for an action.
Parameters:
action - the action for which to get the associated action name; MUST NOT be null
Returns:
the action name; null is returned if the action is not found in the sequence of actions
Throws:
NullPointerException - if action is null
Since:
JDE 4.3.0

getLocale

public String getLocale()
Gets the locale for this set of action names.
Returns:
the locale string; must not be null
Since:
JDE 4.3.0

size

public int size()
Gets the number of pairs of actions and action names.
Returns:
the number of actions and corresponding action names
Since:
JDE 4.3.0



Copyright 1999-2009 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.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.