Use is subject to License Terms. Your use of this web site or any of its contents or software indicates your agreement to be bound by these License Terms.

Copyright © 2006 Sun Microsystems, Inc. All rights reserved.

Java™ 2 Platform, Micro Edition Content Handler API (Final Release, June 3, 2005)

javax.microedition.content
Class ActionNameMap

java.lang.Object
  extended byjavax.microedition.content.ActionNameMap

public final class ActionNameMap
extends java.lang.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.


Constructor Summary
ActionNameMap(java.lang.String[] actions, java.lang.String[] actionnames, java.lang.String locale)
          Create a new map of actions to action names for a locale.
 
Method Summary
 java.lang.String getAction(int index)
          Gets the action at the specified index.
 java.lang.String getAction(java.lang.String actionname)
          Gets the action for the action name.
 java.lang.String getActionName(int index)
          Gets the action name at the specified index.
 java.lang.String getActionName(java.lang.String action)
          Gets the action name for an action.
 java.lang.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(java.lang.String[] actions,
                     java.lang.String[] actionnames,
                     java.lang.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: -
java.lang.NullPointerException - if actions, actionnames, locale, or any array element is null.
Method Detail

getActionName

public java.lang.String getActionName(java.lang.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:
java.lang.NullPointerException - if action is null

getAction

public java.lang.String getAction(java.lang.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:
java.lang.NullPointerException - if actionname is null

getLocale

public java.lang.String getLocale()
Gets the locale for this set of action names.

Returns:
the locale string; must not be null

size

public int size()
Gets the number of pairs of actions and action names.

Returns:
the number of actions and corresponding action names

getAction

public java.lang.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:
java.lang.IndexOutOfBoundsException - if index is less than zero or greater than or equal to the value of the size method.

getActionName

public java.lang.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:
java.lang.IndexOutOfBoundsException - if index is less than zero or greater than or equal to the value of the size method.

Java™ 2 Platform, Micro Edition Content Handler API (Final Release, June 3, 2005)

Copyright © 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

For more information, please consult the JSR 211 specification.