public abstract class AbstractNumberFormatter extends Object implements Formatter<Number>
getNumberFormat(java.util.Locale)
template method.Constructor and Description |
---|
AbstractNumberFormatter() |
Modifier and Type | Method and Description |
---|---|
protected abstract NumberFormat |
getNumberFormat(Locale locale)
Obtain a concrete NumberFormat for the specified locale.
|
Number |
parse(String text,
Locale locale)
Parse a text String to produce a T.
|
String |
print(Number number,
Locale locale)
Print the object of type T for display.
|
void |
setLenient(boolean lenient)
Specify whether or not parsing is to be lenient.
|
public void setLenient(boolean lenient)
With lenient parsing, the parser may allow inputs that do not precisely match the format. With strict parsing, inputs must match the format exactly.
public String print(Number number, Locale locale)
Printer
public Number parse(String text, Locale locale) throws ParseException
Parser
parse
in interface Parser<Number>
text
- the text stringlocale
- the current user localeParseException
- when a parse exception occurs in a java.text parsing libraryprotected abstract NumberFormat getNumberFormat(Locale locale)
locale
- the current localenull
)