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
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
Modifier and TypeClassDescriptionstatic class
DateLocaleConverter.Builder<B extends DateLocaleConverter.Builder<B,
D>, D extends Date> Builds instances ofDateLocaleConverter
. -
Field Summary
Fields inherited from class org.apache.commons.beanutils2.locale.BaseLocaleConverter
defaultValue, locale, localizedPattern, pattern, useDefault
-
Constructor Summary
ModifierConstructorDescriptionprotected
DateLocaleConverter
(D defaultValue, Locale locale, String pattern, boolean useDefault, boolean locPattern, boolean lenient) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic <B extends DateLocaleConverter.Builder<B,
D>, D extends Date>
Bbuilder()
Constructs a new builder.boolean
Tests whether date formatting is lenient.protected D
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
-
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
Constructs a new builder.- Type Parameters:
B
- The builder type.D
- The Date type.- Returns:
- a new builder.
-
isLenient
Tests whether date formatting is lenient.- Returns:
- true if the
DateFormat
used for formatting is lenient - See Also:
-
parse
Convert the specified locale-sensitive input object into an output object of the specified type.- Specified by:
parse
in classBaseLocaleConverter<D extends Date>
- Parameters:
value
- The input object to be convertedpattern
- The pattern is used for the conversion- Returns:
- the converted Date value
- Throws:
ConversionException
- if conversion cannot be performed successfullyParseException
- if an error occurs parsing
-