public abstract class AbstractNumberFormatter extends java.lang.Object implements Formatter<java.lang.Number>
getNumberFormat(java.util.Locale)
template method.Constructor and Description |
---|
AbstractNumberFormatter() |
Modifier and Type | Method and Description |
---|---|
protected abstract java.text.NumberFormat |
getNumberFormat(java.util.Locale locale)
Obtain a concrete NumberFormat for the specified locale.
|
java.lang.Number |
parse(java.lang.String text,
java.util.Locale locale)
Parse a text String to produce a T.
|
java.lang.String |
print(java.lang.Number number,
java.util.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 java.lang.String print(java.lang.Number number, java.util.Locale locale)
Printer
public java.lang.Number parse(java.lang.String text, java.util.Locale locale) throws java.text.ParseException
Parser
protected abstract java.text.NumberFormat getNumberFormat(java.util.Locale locale)
locale
- the current localenull
)