@ThreadSafe public class NumberFormatter extends Object
NumberFormat
(which is not thread-safe).Constructor and Description |
---|
NumberFormatter(java.util.function.Function<Locale,NumberFormat> numberFormatCreator)
Given a function which creates
NumberFormat objects for a Locale , returns a
wrapper providing thread-safe access to the formatter for that locale. |
Modifier and Type | Method and Description |
---|---|
String |
format(Locale locale,
double number) |
StringBuffer |
format(Locale locale,
double number,
StringBuffer toAppendTo,
FieldPosition pos) |
String |
format(Locale locale,
long number) |
String |
format(Locale locale,
Object object) |
StringBuffer |
format(Locale locale,
Object object,
StringBuffer toAppendTo,
FieldPosition pos) |
Number |
parse(Locale locale,
String source) |
Number |
parse(Locale locale,
String source,
ParsePosition pos) |
Object |
parseObject(Locale locale,
String source,
ParsePosition pos) |
public NumberFormatter(java.util.function.Function<Locale,NumberFormat> numberFormatCreator)
NumberFormat
objects for a Locale
, returns a
wrapper providing thread-safe access to the formatter for that locale.public String format(Locale locale, double number)
NumberFormat.format(double)
public StringBuffer format(Locale locale, double number, StringBuffer toAppendTo, FieldPosition pos)
public String format(Locale locale, long number)
NumberFormat.format(long)
public String format(Locale locale, Object object)
Format.format(Object)
public StringBuffer format(Locale locale, Object object, StringBuffer toAppendTo, FieldPosition pos)
public Number parse(Locale locale, String source) throws ParseException
ParseException
NumberFormat.parse(String)
public Number parse(Locale locale, String source, ParsePosition pos)
public Object parseObject(Locale locale, String source, ParsePosition pos)