org.apache.commons.beanutils.locale
Class BaseLocaleConverter
java.lang.Object
org.apache.commons.beanutils.locale.BaseLocaleConverter
- Converter, LocaleConverter
public abstract class BaseLocaleConverter
extends java.lang.Object
The base class for all standart type locale-sensitive converters.
It has
LocaleConverter
and
Converter
implementations,
that convert an incoming locale-sensitive Object into an object of correspond type,
optionally using a default value or throwing a
ConversionException
if a conversion error occurs.
private Object | defaultValue - The default value specified to our Constructor, if any.
|
protected boolean | locPattern - The flag indicating whether the given pattern string is localized or not.
|
protected Locale | locale - The locale specified to our Constructor, by default - system locale.
|
private static Log | log - All logging goes through this logger
|
protected String | pattern - The default pattern specified to our Constructor, if any.
|
protected boolean | useDefault - Should we return the default value on conversion errors?
|
BaseLocaleConverter(Locale locale, String pattern) - Create a
LocaleConverter that will throw a ConversionException
if a conversion error occurs.
|
BaseLocaleConverter(Locale locale, String pattern, boolean locPattern) - Create a
LocaleConverter that will throw a ConversionException
if a conversion error occurs.
|
BaseLocaleConverter(Object defaultValue, Locale locale, String pattern) - Create a
LocaleConverter that will return the specified default value
if a conversion error occurs.
|
BaseLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern) - Create a
LocaleConverter that will return the specified default value
if a conversion error occurs.
|
BaseLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean useDefault, boolean locPattern) - Create a
LocaleConverter that will return the specified default value
or throw a ConversionException if a conversion error occurs.
|
Object | convert(Class type, Object value) - Convert the specified locale-sensitive input object into an output object of the
specified type.
|
Object | convert(Class type, Object value, String pattern) - Convert the specified locale-sensitive input object into an output object of the
specified type.
|
Object | convert(Object value) - Convert the specified locale-sensitive input object into an output object.
|
Object | convert(Object value, String pattern) - Convert the specified locale-sensitive input object into an output object.
|
protected abstract Object | parse(Object value, String pattern) - Convert the specified locale-sensitive input object into an output object of the
specified type.
|
defaultValue
private Object defaultValue
The default value specified to our Constructor, if any.
locPattern
protected boolean locPattern
The flag indicating whether the given pattern string is localized or not.
locale
protected Locale locale
The locale specified to our Constructor, by default - system locale.
log
private static Log log
All logging goes through this logger
pattern
protected String pattern
The default pattern specified to our Constructor, if any.
useDefault
protected boolean useDefault
Should we return the default value on conversion errors?
BaseLocaleConverter
protected BaseLocaleConverter(Locale locale,
String pattern)
locale
- The localepattern
- The convertion pattern
BaseLocaleConverter
protected BaseLocaleConverter(Locale locale,
String pattern,
boolean locPattern)
locale
- The localepattern
- The convertion patternlocPattern
- Indicate whether the pattern is localized or not
BaseLocaleConverter
protected BaseLocaleConverter(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
BaseLocaleConverter
protected BaseLocaleConverter(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
BaseLocaleConverter
private BaseLocaleConverter(Object defaultValue,
Locale locale,
String pattern,
boolean useDefault,
boolean locPattern)
defaultValue
- The default value to be returnedlocale
- The localepattern
- The convertion patternuseDefault
- Indicate whether the default value is used or notlocPattern
- Indicate whether the pattern is localized or not
convert
public Object convert(Class type,
Object value)
Convert the specified locale-sensitive input object into an output object of the
specified type. The default pattern is used for the convertion.
- convert in interface Converter
type
- Data type to which this value should be convertedvalue
- The input object to be converted
convert
public Object convert(Class type,
Object value,
String pattern)
Convert the specified locale-sensitive input object into an output object of the
specified type.
- convert in interface LocaleConverter
type
- Data type to which this value should be convertedvalue
- The input object to be convertedpattern
- The pattern is used for the convertion
convert
public Object convert(Object value)
Convert the specified locale-sensitive input object into an output object.
The default pattern is used for the convertion.
value
- The input object to be converted
convert
public Object convert(Object value,
String pattern)
Convert the specified locale-sensitive input object into an output object.
value
- The input object to be convertedpattern
- The pattern is used for the convertion
parse
protected abstract Object parse(Object value,
String pattern)
throws ParseException
Convert the specified locale-sensitive input object into an output object of the
specified type.
value
- The input object to be convertedpattern
- The pattern is used for the convertion
Copyright (c) 2001-2004 - Apache Software Foundation