Package org.apache.commons.beanutils2.locale.converters

# 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

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `DecimalLocaleConverter.Builder<B extends DecimalLocaleConverter.Builder<B,T>,T extends Number>`
  Builds instances of `DateLocaleConverter`.

- ## Field Summary

  ### Fields inherited from class org.apache.commons.beanutils2.locale.BaseLocaleConverter

  `defaultValue, locale, localizedPattern, pattern, useDefault`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `DecimalLocaleConverter(T defaultValue, Locale locale, String pattern, boolean useDefault, boolean locPattern)`
  Constructs a new instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static <B extends DecimalLocaleConverter.Builder<B, T>, T extends Number>
  B`
  `builder()`
  Constructs a new builder.
  `protected T`
  `parse(Object value, String pattern)`
  Converts the specified locale-sensitive input object into an output object of the specified type.

  ### Methods inherited from class org.apache.commons.beanutils2.locale.BaseLocaleConverter

  `convert, convert, convert, convert`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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