org.mentawai.converter
Class DateConverter

java.lang.Object
  extended by org.mentawai.converter.LocaleConverter
      extended by org.mentawai.converter.DateConverter
All Implemented Interfaces:
Converter

public class DateConverter
extends LocaleConverter

Converts a java.lang.String to a java.util.Date using the user locale.

Author:
Sergio Oliveira

Constructor Summary
DateConverter()
          Creates an converter using the default DateFormat style (SHORT).
DateConverter(int style)
          Creates an converter using the given DateFormat style.
DateConverter(SimpleDateFormat sdf)
           
DateConverter(String pattern)
           
 
Method Summary
 Object convert(Object value, Locale loc)
          Convert an object to another one using the use locale.
 
Methods inherited from class org.mentawai.converter.LocaleConverter
allowNull, convert
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateConverter

public DateConverter()
Creates an converter using the default DateFormat style (SHORT).


DateConverter

public DateConverter(int style)
Creates an converter using the given DateFormat style.

Parameters:
style - The DateFormat style. (Ex: DateFormat.SHORT, DateFormat.FULL, etc.)

DateConverter

public DateConverter(SimpleDateFormat sdf)

DateConverter

public DateConverter(String pattern)
Method Detail

convert

public Object convert(Object value,
                      Locale loc)
               throws ConversionException
Description copied from class: LocaleConverter
Convert an object to another one using the use locale.

Specified by:
convert in class LocaleConverter
Parameters:
value - The object to convert.
loc - The user locale to use in the convertion.
Returns:
The new object converted.
Throws:
ConversionException - if the conversion fail for any reason.


Copyright © 2013. All Rights Reserved.