com.novell.xsl.number
Class NumberFormatters

java.lang.Object
  extended bycom.novell.xsl.number.NumberFormatters

public final class NumberFormatters
extends Object

A non-instantiable class that keeps track of the supported format tokens and their corresponding number formatters.


Method Summary
static void add(String formatToken, String lang, String letterValue, NumberFormatter formatter)
          Defines the specified format token by associating it with the specified number formatter.
static NumberFormatter get(String formatToken, String lang, String letterValue)
          Returns the number formatter corresponding to the specified format token, language, and letter value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

add

public static void add(String formatToken,
                       String lang,
                       String letterValue,
                       NumberFormatter formatter)
                throws IllegalArgumentException
Defines the specified format token by associating it with the specified number formatter.

**** Should lang and letterValue also be specified? ****

To ensure conformance with the XSL spec, this method does not allow the predefined format tokens to be redefined. The predefined tokens are A, a, I, i, and tokens that designate a decimal number format. Tokens that designate a decimal number format are tokens whose last character has a decimal digit value of 1 (as specified in the Unicode 2.0 character property database) and whose other characters have a Unicode value of one less than the Unicode value of the last character.

Parameters:
formatToken - the format token to be defined
lang - the language string corresponding to the formatter (en, en-US, etc.)
letterValue - for letter-value of "alphabetic" or "traditional"
formatter - the corresponding number formatter
Throws:
IllegalArgumentException - if the specified format token is null, "" (the empty string), or one of the tokens predefined by XSL

get

public static NumberFormatter get(String formatToken,
                                  String lang,
                                  String letterValue)
Returns the number formatter corresponding to the specified format token, language, and letter value. If the format token is not explicitly supported, the default number formatter (corresponding to the format token 1) is returned.

Parameters:
formatToken - the format token
lang - the language to use for alphabetic sequences; null means determine the language from the system environment
letterValue - disambiguates between numbering schemes that use letters; must be "alphabetic", "traditional", or null
Returns:
the corresponding number formatter