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

Quick Search    Search Deep

org.apache.commons.beanutils.locale.converters
Class DateLocaleConverter  view DateLocaleConverter download DateLocaleConverter.java

java.lang.Object
  extended byorg.apache.commons.beanutils.locale.BaseLocaleConverter
      extended byorg.apache.commons.beanutils.locale.converters.DateLocaleConverter
All Implemented Interfaces:
org.apache.commons.beanutils.Converter, org.apache.commons.beanutils.locale.LocaleConverter
Direct Known Subclasses:
SqlDateLocaleConverter, SqlTimeLocaleConverter, SqlTimestampLocaleConverter

public class DateLocaleConverter
extends org.apache.commons.beanutils.locale.BaseLocaleConverter

Standard org.apache.commons.beanutils.locale.LocaleConverter implementation that converts an incoming locale-sensitive String into a java.util.Date object, optionally using a default value or throwing a org.apache.commons.beanutils.ConversionException if a conversion error occurs.


Field Summary
(package private)  boolean isLenient
          Should the date conversion be lenient?
private static org.apache.commons.logging.Log log
          All logging goes through this logger
 
Fields inherited from class org.apache.commons.beanutils.locale.BaseLocaleConverter
locale, locPattern, pattern, useDefault
 
Constructor Summary
DateLocaleConverter()
          Create a org.apache.commons.beanutils.locale.LocaleConverter that will throw a org.apache.commons.beanutils.ConversionException if a conversion error occurs.
DateLocaleConverter(boolean locPattern)
          Create a org.apache.commons.beanutils.locale.LocaleConverter that will throw a org.apache.commons.beanutils.ConversionException if a conversion error occurs.
DateLocaleConverter(java.util.Locale locale)
          Create a org.apache.commons.beanutils.locale.LocaleConverter that will throw a org.apache.commons.beanutils.ConversionException if a conversion error occurs.
DateLocaleConverter(java.util.Locale locale, boolean locPattern)
          Create a org.apache.commons.beanutils.locale.LocaleConverter that will throw a org.apache.commons.beanutils.ConversionException if a conversion error occurs.
DateLocaleConverter(java.util.Locale locale, java.lang.String pattern)
          Create a org.apache.commons.beanutils.locale.LocaleConverter that will throw a org.apache.commons.beanutils.ConversionException if a conversion error occurs.
DateLocaleConverter(java.util.Locale locale, java.lang.String pattern, boolean locPattern)
          Create a org.apache.commons.beanutils.locale.LocaleConverter that will throw a org.apache.commons.beanutils.ConversionException if a conversion error occurs.
DateLocaleConverter(java.lang.Object defaultValue)
          Create a org.apache.commons.beanutils.locale.LocaleConverter that will return the specified default value if a conversion error occurs.
DateLocaleConverter(java.lang.Object defaultValue, boolean locPattern)
          Create a org.apache.commons.beanutils.locale.LocaleConverter that will return the specified default value if a conversion error occurs.
DateLocaleConverter(java.lang.Object defaultValue, java.util.Locale locale)
          Create a org.apache.commons.beanutils.locale.LocaleConverter that will return the specified default value if a conversion error occurs.
DateLocaleConverter(java.lang.Object defaultValue, java.util.Locale locale, boolean locPattern)
          Create a org.apache.commons.beanutils.locale.LocaleConverter that will return the specified default value if a conversion error occurs.
DateLocaleConverter(java.lang.Object defaultValue, java.util.Locale locale, java.lang.String pattern)
          Create a org.apache.commons.beanutils.locale.LocaleConverter that will return the specified default value if a conversion error occurs.
DateLocaleConverter(java.lang.Object defaultValue, java.util.Locale locale, java.lang.String pattern, boolean locPattern)
          Create a org.apache.commons.beanutils.locale.LocaleConverter that will return the specified default value if a conversion error occurs.
 
Method Summary
private  java.text.SimpleDateFormat getFormatter(java.lang.String pattern, java.util.Locale locale)
          Gets an appropriate SimpleDateFormat for given locale, default Date format pattern is not provided.
 boolean isLenient()
          Returns whether date formatting is lenient.
protected  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.
 void setLenient(boolean lenient)
          Specify whether or not date-time parsing should be lenient.
 
Methods inherited from class org.apache.commons.beanutils.locale.BaseLocaleConverter
convert, convert, convert, convert
 
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


isLenient

boolean isLenient
Should the date conversion be lenient?

Constructor Detail

DateLocaleConverter

public DateLocaleConverter()
Create a org.apache.commons.beanutils.locale.LocaleConverter that will throw a org.apache.commons.beanutils.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(boolean locPattern)
Create a org.apache.commons.beanutils.locale.LocaleConverter that will throw a org.apache.commons.beanutils.ConversionException if a conversion error occurs. The locale is the default locale for this instance of the Java Virtual Machine.


DateLocaleConverter

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


DateLocaleConverter

public DateLocaleConverter(java.util.Locale locale,
                           boolean locPattern)
Create a org.apache.commons.beanutils.locale.LocaleConverter that will throw a org.apache.commons.beanutils.ConversionException if a conversion error occurs.


DateLocaleConverter

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


DateLocaleConverter

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


DateLocaleConverter

public DateLocaleConverter(java.lang.Object defaultValue)
Create a org.apache.commons.beanutils.locale.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.


DateLocaleConverter

public DateLocaleConverter(java.lang.Object defaultValue,
                           boolean locPattern)
Create a org.apache.commons.beanutils.locale.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.


DateLocaleConverter

public DateLocaleConverter(java.lang.Object defaultValue,
                           java.util.Locale locale)
Create a org.apache.commons.beanutils.locale.LocaleConverter that will return the specified default value if a conversion error occurs. An unlocalized pattern is used for the convertion.


DateLocaleConverter

public DateLocaleConverter(java.lang.Object defaultValue,
                           java.util.Locale locale,
                           boolean locPattern)
Create a org.apache.commons.beanutils.locale.LocaleConverter that will return the specified default value if a conversion error occurs.


DateLocaleConverter

public DateLocaleConverter(java.lang.Object defaultValue,
                           java.util.Locale locale,
                           java.lang.String pattern)
Create a org.apache.commons.beanutils.locale.LocaleConverter that will return the specified default value if a conversion error occurs. An unlocalized pattern is used for the convertion.


DateLocaleConverter

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

Method Detail

isLenient

public boolean isLenient()
Returns whether date formatting is lenient.


setLenient

public void setLenient(boolean lenient)
Specify whether or not date-time parsing should be lenient.


parse

protected 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.


getFormatter

private java.text.SimpleDateFormat getFormatter(java.lang.String pattern,
                                                java.util.Locale locale)
Gets an appropriate SimpleDateFormat for given locale, default Date format pattern is not provided.