public class BigDecimalFormatter extends AbstractFormatter<BigDecimal>
Modifier and Type | Field and Description |
---|---|
static String |
PATTERN_CURRENCY |
static String |
PATTERN_PERCENT |
Constructor and Description |
---|
BigDecimalFormatter() |
BigDecimalFormatter(String pattern) |
Modifier and Type | Method and Description |
---|---|
String |
format(BigDecimal number)
Formats an instance into its literal representation.
|
BigDecimal |
parse(String str)
Parses a literal representation into an instance of type
T . |
parseError, parseError, parseHexInt, parseHexInt
public static final String PATTERN_CURRENCY
public static final String PATTERN_PERCENT
@Nullable public String format(@Nullable BigDecimal number)
Formatter
Formats an instance into its literal representation.
The resulting String
may be set as an argument to Formatter.parse(java.lang.String)
resulting in a similar instance as the input.
number
- the instance to be formattedString
representing the instance's state.@Nullable public BigDecimal parse(@Nullable String str) throws ParseException
Formatter
Parses a literal representation into an instance of type T
.
The resulting instance T
may be set as an argument to Formatter.format(T)
resulting in an equal String
as the input.
str
- the String
to be parsedT
whose state is initialized given the
parameters of the input String
.ParseException
- if the String
cannot be parsed.