Class DecimalLocaleConverter<T extends Number>
java.lang.Object
org.apache.commons.beanutils2.locale.BaseLocaleConverter<T>
org.apache.commons.beanutils2.locale.converters.DecimalLocaleConverter<T>
- Type Parameters:
T- The converter type.
- All Implemented Interfaces:
Converter<T>,LocaleConverter<T>
- Direct Known Subclasses:
BigDecimalLocaleConverter,BigIntegerLocaleConverter,ByteLocaleConverter,DoubleLocaleConverter,FloatLocaleConverter,IntegerLocaleConverter,LongLocaleConverter,ShortLocaleConverter
Standard
LocaleConverter implementation that converts an incoming locale-sensitive String into a Number object, optionally using a default
value or throwing a ConversionException if a conversion error occurs.- Since:
- 1.7
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDecimalLocaleConverter.Builder<B extends DecimalLocaleConverter.Builder<B,T>, T extends Number> Builds instances ofDateLocaleConverter. -
Field Summary
Fields inherited from class org.apache.commons.beanutils2.locale.BaseLocaleConverter
defaultValue, locale, localizedPattern, pattern, useDefault -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDecimalLocaleConverter(T defaultValue, Locale locale, String pattern, boolean useDefault, boolean locPattern) Constructs a new instance. -
Method Summary
Methods inherited from class org.apache.commons.beanutils2.locale.BaseLocaleConverter
convert, convert, convert, convert
-
Constructor Details
-
DecimalLocaleConverter
protected DecimalLocaleConverter(T defaultValue, Locale locale, String pattern, boolean useDefault, boolean locPattern) Constructs a new instance.- Parameters:
defaultValue- default value.locale- locale.pattern- pattern.useDefault- use the default.locPattern- localized pattern.
-
-
Method Details
-
builder
Constructs a new builder.- Type Parameters:
B- The builder type.T- The Number type.- Returns:
- a new builder.
-
parse
Converts the specified locale-sensitive input object into an output object of the specified type.- Specified by:
parsein classBaseLocaleConverter<T extends Number>- Parameters:
value- The input object to be convertedpattern- The pattern is used for the conversion- Returns:
- The converted value
- Throws:
ConversionException- if conversion cannot be performed successfullyParseException- if an error occurs parsing a String to a Number
-