Class FastChoiceFormat
- java.lang.Object
-
- org.pentaho.reporting.libraries.formatting.FastChoiceFormat
-
- All Implemented Interfaces:
Serializable
,Cloneable
,FastFormat
public class FastChoiceFormat extends Object implements FastFormat
A wrapper around the java.text.ChoiceFormat class. This wrapper limits the possible interactions with the wrapped format class and therefore eliminates the need to clone the choice format whenever the wrapper is cloned.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FastChoiceFormat(String pattern)
Creates a new ChoiceFormat with the given pattern and the default locale.FastChoiceFormat(String pattern, Locale locale)
Creates a new ChoiceFormat with the given pattern and locale.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FastChoiceFormat
clone()
Clones the object.String
format(Object parameters)
Formats the given object using the choice-pattern.Locale
getLocale()
Returns the current locale of the formatter.String
getPattern()
Returns the currently active pattern.
-
-
-
Constructor Detail
-
FastChoiceFormat
public FastChoiceFormat(String pattern)
Creates a new ChoiceFormat with the given pattern and the default locale.- Parameters:
pattern
- the pattern.
-
-
Method Detail
-
getLocale
public Locale getLocale()
Returns the current locale of the formatter.- Specified by:
getLocale
in interfaceFastFormat
- Returns:
- the current locale, never null.
-
getPattern
public String getPattern()
Returns the currently active pattern.- Returns:
- the locale.
-
format
public String format(Object parameters)
Formats the given object using the choice-pattern.- Specified by:
format
in interfaceFastFormat
- Parameters:
parameters
- the parameters, usually a Number- or Date object.- Returns:
- the formatted text.
-
clone
public FastChoiceFormat clone()
Clones the object.- Specified by:
clone
in interfaceFastFormat
- Overrides:
clone
in classObject
- Returns:
- the clone.
- Throws:
CloneNotSupportedException
- if cloning failed for some reason.
-
-