com.gisgraphy.util
Class DateConverter

java.lang.Object
  extended by com.gisgraphy.util.DateConverter
All Implemented Interfaces:
org.apache.commons.beanutils.Converter
Direct Known Subclasses:
TimestampConverter

public class DateConverter
extends Object
implements org.apache.commons.beanutils.Converter

This class is converts a java.util.Date to a String and a String to a java.util.Date.

Author:
Matt Raible

Constructor Summary
DateConverter()
           
 
Method Summary
 Object convert(Class type, Object value)
          Convert a date to a String and a String to a Date
protected  Object convertToDate(Class type, Object value, String pattern)
          Convert a String to a Date with the specified pattern.
protected  Object convertToString(Class type, Object value)
          Convert a java.util.Date to a String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateConverter

public DateConverter()
Method Detail

convert

public Object convert(Class type,
                      Object value)
Convert a date to a String and a String to a Date

Specified by:
convert in interface org.apache.commons.beanutils.Converter
Parameters:
type - String, Date or Timestamp
value - value to convert
Returns:
Converted value for property population

convertToDate

protected Object convertToDate(Class type,
                               Object value,
                               String pattern)
Convert a String to a Date with the specified pattern.

Parameters:
type - String
value - value of String
pattern - date pattern to parse with
Returns:
Converted value for property population

convertToString

protected Object convertToString(Class type,
                                 Object value)
Convert a java.util.Date to a String

Parameters:
type - Date or Timestamp
value - value to convert
Returns:
Converted value for property population


Copyright © 2012. All Rights Reserved.