org.norther.tammi.core.converter
Interface NumberConverter

All Superinterfaces:
ObjectConverter
All Known Implementing Classes:
DefaultNumberConverter

public interface NumberConverter
extends ObjectConverter

A converter for instances representing numbers.

Author:
Ilkka Priha

Field Summary
static String CURRENCY
          A pattern for currency formatting.
static String CURRENCY_IN_CENTS
          A pattern for currency in cents formatting.
static String DEFAULT
          A pattern for default formatting.
static String INTEGER
          A pattern for integer formatting.
static String NUMBER
          A pattern for number formatting.
static String PERCENT
          A pattern for percent formatting.
 
Method Summary
 NumberFormat getNumberFormat(String pattern)
          Gets a number format for the specified pattern.
 NumberFormat getNumberFormat(String pattern, Locale locale)
          Gets a number format for the specified pattern and locale.
 
Methods inherited from interface org.norther.tammi.core.converter.ObjectConverter
getFormatPattern, getInstance, getInstance, getInstance, getLocalizedPattern, getResourceFinderName, isConversionSupported, setResourceFinderName, toString, toString, toString, toStrings, toStrings, toStrings
 

Field Detail

DEFAULT

static final String DEFAULT
A pattern for default formatting. The default instance of the number formatter will be applied.

See Also:
Constant Field Values

NUMBER

static final String NUMBER
A pattern for number formatting. The general-purpose instance of the number formatter will be applied.

See Also:
Constant Field Values

INTEGER

static final String INTEGER
A pattern for integer formatting. The integer instance of the number formatter will be applied.

See Also:
Constant Field Values

PERCENT

static final String PERCENT
A pattern for percent formatting. The percent instance of the number formatter will be applied.

See Also:
Constant Field Values

CURRENCY

static final String CURRENCY
A pattern for currency formatting. The currency instance of the number formatter will be applied.

See Also:
Constant Field Values

CURRENCY_IN_CENTS

static final String CURRENCY_IN_CENTS
A pattern for currency in cents formatting. The currency instance of the number formatter will be applied.

When an instance is returned the given value will be multiplied with 100 as it will have two decimals. When an instance is converted to a string the value will be divided by 100 in order to have two decimals.

See Also:
Constant Field Values
Method Detail

getNumberFormat

NumberFormat getNumberFormat(String pattern)
Gets a number format for the specified pattern.

Parameters:
pattern - the pattern.
Returns:
the requested number format.
See Also:
NumberFormat, DecimalFormat

getNumberFormat

NumberFormat getNumberFormat(String pattern,
                             Locale locale)
Gets a number format for the specified pattern and locale.

Parameters:
pattern - the pattern.
locale - the locale.
Returns:
the requested number format.
See Also:
NumberFormat, DecimalFormat


Copyright © 2004 The Norther Organization. All rights reserved.