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

public class DecimalLocaleConverter<T extends Number> extends BaseLocaleConverter<T>
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
  • 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

      public static <B extends DecimalLocaleConverter.Builder<B, T>, T extends Number> B builder()
      Constructs a new builder.
      Type Parameters:
      B - The builder type.
      T - The Number type.
      Returns:
      a new builder.
    • parse

      protected T parse(Object value, String pattern) throws ParseException
      Converts the specified locale-sensitive input object into an output object of the specified type.
      Specified by:
      parse in class BaseLocaleConverter<T extends Number>
      Parameters:
      value - The input object to be converted
      pattern - The pattern is used for the conversion
      Returns:
      The converted value
      Throws:
      ConversionException - if conversion cannot be performed successfully
      ParseException - if an error occurs parsing a String to a Number