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

# Class DateLocaleConverter<D extends Date>

java.lang.Object
org.apache.commons.beanutils2.locale.BaseLocaleConverter<D>
org.apache.commons.beanutils2.locale.converters.DateLocaleConverter<D>

Type Parameters:
  `D` - The Date type.

All Implemented Interfaces:
  `Converter<D>`, `LocaleConverter<D>`

Direct Known Subclasses:
  `SqlDateLocaleConverter`, `SqlTimeLocaleConverter`, `SqlTimestampLocaleConverter`

public class DateLocaleConverter<D extends Date> extends BaseLocaleConverter<D>
Standard `LocaleConverter` implementation that converts an incoming locale-sensitive String into a `Date` object, optionally using a default value or throwing a `ConversionException` if a conversion error occurs.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `DateLocaleConverter.Builder<B extends DateLocaleConverter.Builder<B,D>,D extends Date>`
  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`
  `DateLocaleConverter(D defaultValue, Locale locale, String pattern, boolean useDefault, boolean locPattern, boolean lenient)`
  Constructs a new instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static <B extends DateLocaleConverter.Builder<B, D>, D extends Date>
  B`
  `builder()`
  Constructs a new builder.
  `boolean`
  `isLenient()`
  Tests whether date formatting is lenient.
  `protected D`
  `parse(Object value, String pattern)`
  Convert 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

  - ### DateLocaleConverter

    protected DateLocaleConverter(D defaultValue, Locale locale, String pattern, boolean useDefault, boolean locPattern, boolean lenient)
    Constructs a new instance.
    Parameters:
      `defaultValue` - default value.
      `locale` - locale.
      `pattern` - pattern.
      `useDefault` - use the default.
      `locPattern` - localized pattern.
      `lenient` - leniency policy.

- ## Method Details

  - ### builder

    public static <B extends DateLocaleConverter.Builder<B, D>, D extends Date> B builder()
    Constructs a new builder.
    Type Parameters:
      `B` - The builder type.
      `D` - The Date type.
    Returns:
      a new builder.

  - ### isLenient

    public boolean isLenient()
    Tests whether date formatting is lenient.
    Returns:
      true if the `DateFormat` used for formatting is lenient
    See Also:
      - `DateFormat.isLenient()`

  - ### parse

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