org.apache.commons.beanutils.locale
public abstract class BaseLocaleConverter extends Object implements LocaleConverter
The base class for all standart type locale-sensitive converters. It has {@link LocaleConverter} and {@link org.apache.commons.beanutils.Converter} implementations, that convert an incoming locale-sensitive Object into an object of correspond type, optionally using a default value or throwing a {@link ConversionException} if a conversion error occurs.
Field Summary | |
---|---|
Object | defaultValue The default value specified to our Constructor, if any. |
protected Locale | locale The locale specified to our Constructor, by default - system locale. |
protected boolean | locPattern The flag indicating whether the given pattern string is localized or not. |
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? |
Constructor Summary | |
---|---|
protected | BaseLocaleConverter(Locale locale, String pattern)
Create a {@link LocaleConverter} that will throw a {@link ConversionException}
if a conversion error occurs.
|
protected | BaseLocaleConverter(Locale locale, String pattern, boolean locPattern)
Create a {@link LocaleConverter} that will throw a {@link ConversionException}
if a conversion error occurs.
|
protected | BaseLocaleConverter(Object defaultValue, Locale locale, String pattern)
Create a {@link LocaleConverter} that will return the specified default value
if a conversion error occurs.
|
protected | BaseLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern)
Create a {@link 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 {@link LocaleConverter} that will return the specified default value
or throw a {@link ConversionException} if a conversion error occurs.
|
Method Summary | |
---|---|
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.
|
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.
|
protected abstract Object | parse(Object value, String pattern)
Convert the specified locale-sensitive input object into an output object of the
specified type.
|
Parameters: locale The locale pattern The convertion pattern
Parameters: locale The locale pattern The convertion pattern locPattern Indicate whether the pattern is localized or not
Parameters: defaultValue The default value to be returned locale The locale pattern The convertion pattern
Parameters: defaultValue The default value to be returned locale The locale pattern The convertion pattern locPattern Indicate whether the pattern is localized or not
Parameters: defaultValue The default value to be returned locale The locale pattern The convertion pattern useDefault Indicate whether the default value is used or not locPattern Indicate whether the pattern is localized or not
Parameters: value The input object to be converted
Throws: ConversionException if conversion cannot be performed successfully
Parameters: value The input object to be converted pattern The pattern is used for the convertion
Throws: ConversionException if conversion cannot be performed successfully
Parameters: type Data type to which this value should be converted value The input object to be converted
Throws: ConversionException if conversion cannot be performed successfully
Parameters: type Data type to which this value should be converted value The input object to be converted pattern The pattern is used for the convertion
Throws: ConversionException if conversion cannot be performed successfully
Parameters: value The input object to be converted pattern The pattern is used for the convertion
Throws: ConversionException if conversion cannot be performed successfully