Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.commons.beanutils.locale
Class BaseLocaleConverter  view BaseLocaleConverter download BaseLocaleConverter.java

java.lang.Object
  extended byorg.apache.commons.beanutils.locale.BaseLocaleConverter
All Implemented Interfaces:
org.apache.commons.beanutils.Converter, LocaleConverter

public abstract class BaseLocaleConverter
extends java.lang.Object
implements LocaleConverter

The base class for all standart type locale-sensitive converters. It has LocaleConverter and 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 org.apache.commons.beanutils.ConversionException if a conversion error occurs.


Field Summary
private  java.lang.Object defaultValue
          The default value specified to our Constructor, if any.
protected  java.util.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.
private static org.apache.commons.logging.Log log
          All logging goes through this logger
protected  java.lang.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(java.util.Locale locale, java.lang.String pattern)
          Create a LocaleConverter that will throw a org.apache.commons.beanutils.ConversionException if a conversion error occurs.
protected BaseLocaleConverter(java.util.Locale locale, java.lang.String pattern, boolean locPattern)
          Create a LocaleConverter that will throw a org.apache.commons.beanutils.ConversionException if a conversion error occurs.
protected BaseLocaleConverter(java.lang.Object defaultValue, java.util.Locale locale, java.lang.String pattern)
          Create a LocaleConverter that will return the specified default value if a conversion error occurs.
protected BaseLocaleConverter(java.lang.Object defaultValue, java.util.Locale locale, java.lang.String pattern, boolean locPattern)
          Create a LocaleConverter that will return the specified default value if a conversion error occurs.
private BaseLocaleConverter(java.lang.Object defaultValue, java.util.Locale locale, java.lang.String pattern, boolean useDefault, boolean locPattern)
          Create a LocaleConverter that will return the specified default value or throw a org.apache.commons.beanutils.ConversionException if a conversion error occurs.
 
Method Summary
 java.lang.Object convert(java.lang.Class type, java.lang.Object value)
          Convert the specified locale-sensitive input object into an output object of the specified type.
 java.lang.Object convert(java.lang.Class type, java.lang.Object value, java.lang.String pattern)
          Convert the specified locale-sensitive input object into an output object of the specified type.
 java.lang.Object convert(java.lang.Object value)
          Convert the specified locale-sensitive input object into an output object.
 java.lang.Object convert(java.lang.Object value, java.lang.String pattern)
          Convert the specified locale-sensitive input object into an output object.
protected abstract  java.lang.Object parse(java.lang.Object value, java.lang.String pattern)
          Convert the specified locale-sensitive input object into an output object of the specified type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log
All logging goes through this logger


defaultValue

private java.lang.Object defaultValue
The default value specified to our Constructor, if any.


useDefault

protected boolean useDefault
Should we return the default value on conversion errors?


locale

protected java.util.Locale locale
The locale specified to our Constructor, by default - system locale.


pattern

protected java.lang.String pattern
The default pattern specified to our Constructor, if any.


locPattern

protected boolean locPattern
The flag indicating whether the given pattern string is localized or not.

Constructor Detail

BaseLocaleConverter

protected BaseLocaleConverter(java.util.Locale locale,
                              java.lang.String pattern)
Create a LocaleConverter that will throw a org.apache.commons.beanutils.ConversionException if a conversion error occurs. An unlocalized pattern is used for the convertion.


BaseLocaleConverter

protected BaseLocaleConverter(java.util.Locale locale,
                              java.lang.String pattern,
                              boolean locPattern)
Create a LocaleConverter that will throw a org.apache.commons.beanutils.ConversionException if a conversion error occurs.


BaseLocaleConverter

protected BaseLocaleConverter(java.lang.Object defaultValue,
                              java.util.Locale locale,
                              java.lang.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.


BaseLocaleConverter

protected BaseLocaleConverter(java.lang.Object defaultValue,
                              java.util.Locale locale,
                              java.lang.String pattern,
                              boolean locPattern)
Create a LocaleConverter that will return the specified default value if a conversion error occurs.


BaseLocaleConverter

private BaseLocaleConverter(java.lang.Object defaultValue,
                            java.util.Locale locale,
                            java.lang.String pattern,
                            boolean useDefault,
                            boolean locPattern)
Create a LocaleConverter that will return the specified default value or throw a org.apache.commons.beanutils.ConversionException if a conversion error occurs.

Method Detail

parse

protected abstract java.lang.Object parse(java.lang.Object value,
                                          java.lang.String pattern)
                                   throws java.text.ParseException
Convert the specified locale-sensitive input object into an output object of the specified type.


convert

public java.lang.Object convert(java.lang.Object value)
Convert the specified locale-sensitive input object into an output object. The default pattern is used for the convertion.


convert

public java.lang.Object convert(java.lang.Object value,
                                java.lang.String pattern)
Convert the specified locale-sensitive input object into an output object.


convert

public java.lang.Object convert(java.lang.Class type,
                                java.lang.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.

Specified by:
convert in interface org.apache.commons.beanutils.Converter

convert

public java.lang.Object convert(java.lang.Class type,
                                java.lang.Object value,
                                java.lang.String pattern)
Convert the specified locale-sensitive input object into an output object of the specified type.

Specified by:
convert in interface LocaleConverter