org.apache.commons.beanutils.locale.converters
Class DateLocaleConverter
- Converter, LocaleConverter
public class DateLocaleConverter
Standard
LocaleConverter
implementation that converts an incoming
locale-sensitive String into a
java.util.Date
object,
optionally using a default value or throwing a
ConversionException
if a conversion error occurs.
- Yauheny Mikulski
- Michael Szlapa
private static String | DEFAULT_PATTERN_CHARS - Default Pattern Characters
|
(package private) boolean | isLenient - Should the date conversion be lenient?
|
private Log | log - All logging goes through this logger
|
DateLocaleConverter() - Create a
LocaleConverter
that will throw a ConversionException
if a conversion error occurs.
|
DateLocaleConverter(Locale locale) - Create a
LocaleConverter
that will throw a ConversionException
if a conversion error occurs.
|
DateLocaleConverter(Locale locale, String pattern) - Create a
LocaleConverter
that will throw a ConversionException
if a conversion error occurs.
|
DateLocaleConverter(Locale locale, String pattern, boolean locPattern) - Create a
LocaleConverter
that will throw a ConversionException
if a conversion error occurs.
|
DateLocaleConverter(Locale locale, boolean locPattern) - Create a
LocaleConverter
that will throw a ConversionException
if a conversion error occurs.
|
DateLocaleConverter(Object defaultValue) - Create a
LocaleConverter
that will return the specified default value
if a conversion error occurs.
|
DateLocaleConverter(Object defaultValue, Locale locale) - Create a
LocaleConverter
that will return the specified default value
if a conversion error occurs.
|
DateLocaleConverter(Object defaultValue, Locale locale, String pattern) - Create a
LocaleConverter
that will return the specified default value
if a conversion error occurs.
|
DateLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern) - Create a
LocaleConverter
that will return the specified default value
if a conversion error occurs.
|
DateLocaleConverter(Object defaultValue, Locale locale, boolean locPattern) - Create a
LocaleConverter
that will return the specified default value
if a conversion error occurs.
|
DateLocaleConverter(Object defaultValue, boolean locPattern) - Create a
LocaleConverter
that will return the specified default value
if a conversion error occurs.
|
DateLocaleConverter(boolean locPattern) - Create a
LocaleConverter
that will throw a ConversionException
if a conversion error occurs.
|
private String | convertLocalizedPattern(String localizedPattern, Locale locale) - Convert a pattern from a localized format to the default format.
|
private String | convertPattern(String pattern, String fromChars, String toChars) - Converts a Pattern from one character set to another.
|
private static String | initDefaultChars() - This method is called at class initialization time to define the
value for constant member DEFAULT_PATTERN_CHARS.
|
boolean | isLenient() - Returns whether date formatting is lenient.
|
protected Object | parse(Object value, String pattern) - Convert the specified locale-sensitive input object into an output object of the
specified type.
|
void | setLenient(boolean lenient) - Specify whether or not date-time parsing should be lenient.
|
DEFAULT_PATTERN_CHARS
private static final String DEFAULT_PATTERN_CHARS
Default Pattern Characters
isLenient
(package private) boolean isLenient
Should the date conversion be lenient?
log
private Log log
All logging goes through this logger
DateLocaleConverter
public DateLocaleConverter()
Create a
LocaleConverter
that will throw a
ConversionException
if a conversion error occurs. The locale is the default locale for
this instance of the Java Virtual Machine and an unlocalized pattern is used
for the convertion.
DateLocaleConverter
public DateLocaleConverter(Locale locale)
DateLocaleConverter
public DateLocaleConverter(Locale locale,
String pattern)
locale
- The localepattern
- The convertion pattern
DateLocaleConverter
public DateLocaleConverter(Locale locale,
String pattern,
boolean locPattern)
locale
- The localepattern
- The convertion patternlocPattern
- Indicate whether the pattern is localized or not
DateLocaleConverter
public DateLocaleConverter(Locale locale,
boolean locPattern)
locale
- The localelocPattern
- Indicate whether the pattern is localized or not
DateLocaleConverter
public DateLocaleConverter(Object defaultValue)
Create a
LocaleConverter
that will return the specified default value
if a conversion error occurs. The locale is the default locale for
this instance of the Java Virtual Machine and an unlocalized pattern is used
for the convertion.
defaultValue
- The default value to be returned
DateLocaleConverter
public DateLocaleConverter(Object defaultValue,
Locale locale)
Create a
LocaleConverter
that will return the specified default value
if a conversion error occurs. An unlocalized pattern is used for the convertion.
defaultValue
- The default value to be returnedlocale
- The locale
DateLocaleConverter
public DateLocaleConverter(Object defaultValue,
Locale locale,
String pattern)
Create a
LocaleConverter
that will return the specified default value
if a conversion error occurs. An unlocalized pattern is used for the convertion.
defaultValue
- The default value to be returnedlocale
- The localepattern
- The convertion pattern
DateLocaleConverter
public DateLocaleConverter(Object defaultValue,
Locale locale,
String pattern,
boolean locPattern)
Create a
LocaleConverter
that will return the specified default value
if a conversion error occurs.
defaultValue
- The default value to be returnedlocale
- The localepattern
- The convertion patternlocPattern
- Indicate whether the pattern is localized or not
DateLocaleConverter
public DateLocaleConverter(Object defaultValue,
Locale locale,
boolean locPattern)
Create a
LocaleConverter
that will return the specified default value
if a conversion error occurs.
defaultValue
- The default value to be returnedlocale
- The localelocPattern
- Indicate whether the pattern is localized or not
DateLocaleConverter
public DateLocaleConverter(Object defaultValue,
boolean locPattern)
Create a
LocaleConverter
that will return the specified default value
if a conversion error occurs. The locale is the default locale for
this instance of the Java Virtual Machine.
defaultValue
- The default value to be returnedlocPattern
- Indicate whether the pattern is localized or not
DateLocaleConverter
public DateLocaleConverter(boolean locPattern)
Create a
LocaleConverter
that will throw a
ConversionException
if a conversion error occurs. The locale is the default locale for
this instance of the Java Virtual Machine.
locPattern
- Indicate whether the pattern is localized or not
convertLocalizedPattern
private String convertLocalizedPattern(String localizedPattern,
Locale locale)
Convert a pattern from a localized format to the default format.
localizedPattern
- The pattern in 'local' symbol formatlocale
- The locale
- pattern in 'default' symbol format
convertPattern
private String convertPattern(String pattern,
String fromChars,
String toChars)
Converts a Pattern from one character set to another.
initDefaultChars
private static String initDefaultChars()
This method is called at class initialization time to define the
value for constant member DEFAULT_PATTERN_CHARS. All other methods needing
this data should just read that constant.
isLenient
public boolean isLenient()
Returns whether date formatting is lenient.
- true if the
DateFormat
used for formatting is lenient
java.text.DateFormat.isLenient
parse
protected Object parse(Object value,
String pattern)
throws ParseException
Convert the specified locale-sensitive input object into an output object of the
specified type.
- parse in interface BaseLocaleConverter
value
- The input object to be convertedpattern
- The pattern is used for the convertion
setLenient
public void setLenient(boolean lenient)
Specify whether or not date-time parsing should be lenient.
lenient
- true if the DateFormat
used for formatting should be lenient
java.text.DateFormat.setLenient
Copyright (c) 2001-2007 - Apache Software Foundation