public class BigDecimalConverter extends Object implements SimpleTypeConverter
BigDecimal
objects.String
s. The first denotes the Locale
and the second is a
pattern as used by DecimalFormat
.
It is thread-safe (the access to the non-thread-safe DecimalFormat
is synchronized).
Modifier | Constructor and Description |
---|---|
protected |
BigDecimalConverter(SimpleTypeConverterConfiguration configuration)
Constructs a new
BigDecimalConverter .If no format is given, the default format (see getDefaultFormat() ) is used. |
Modifier and Type | Method and Description |
---|---|
static BigDecimalConverter |
create(SimpleTypeConverterConfiguration configuration)
Creates a
BigDecimalConverter .If no format is given, the default format (see getDefaultFormat() ) is used. |
BigDecimal |
fromString(String value)
Converts the given
String object into an object with the simple data type this converter is
intended for. |
protected String[] |
getDefaultFormat()
Returns the default format which is used when no format is given.
|
String |
toString(Object value)
Converts the given value to a
String object. |
protected BigDecimalConverter(SimpleTypeConverterConfiguration configuration)
BigDecimalConverter
.getDefaultFormat()
) is used.configuration
- the configurationConversionException
- if the given format is not valid.public static BigDecimalConverter create(SimpleTypeConverterConfiguration configuration)
BigDecimalConverter
.getDefaultFormat()
) is used.configuration
- the configurationConversionException
- if the given format is not valid.public final BigDecimal fromString(String value)
String
object into an object with the simple data type this converter is
intended for.fromString
in interface SimpleTypeConverter
value
- the String
object to convertpublic final String toString(Object value)
String
object.toString
in interface SimpleTypeConverter
value
- the value to convertprotected String[] getDefaultFormat()
Copyright © 2014. All rights reserved.