org.eobjects.metamodel.convert
Class StringToDateConverter

java.lang.Object
  extended by org.eobjects.metamodel.convert.StringToDateConverter
All Implemented Interfaces:
TypeConverter<String,Date>

public class StringToDateConverter
extends Object
implements TypeConverter<String,Date>

A TypeConverter that converts String values (on the physical layer) to interpreted Dates.

Author:
Kasper Sørensen, Ankit Kumar

Constructor Summary
StringToDateConverter()
          Constructs a new StringToDateConverter which will use the TimeComparator.toDate(Object) method for parsing dates and the DateFormat.MEDIUM date time format for physical representation.
StringToDateConverter(DateFormat dateFormat)
          Constructs a new StringToDateConverter using a given DateFormat.
StringToDateConverter(String datePattern)
          Constructs a new StringToDateConverter using a given date pattern.
 
Method Summary
 String toPhysicalValue(Date virtualValue)
          Converts a virtual representation of a value into it's physical value.
 Date toVirtualValue(String physicalValue)
          Converts a physical value into it's virtual representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringToDateConverter

public StringToDateConverter()
Constructs a new StringToDateConverter which will use the TimeComparator.toDate(Object) method for parsing dates and the DateFormat.MEDIUM date time format for physical representation.


StringToDateConverter

public StringToDateConverter(String datePattern)
Constructs a new StringToDateConverter using a given date pattern.

Parameters:
datePattern - a String date pattern, corresponding to the syntax of a SimpleDateFormat.

StringToDateConverter

public StringToDateConverter(DateFormat dateFormat)
Constructs a new StringToDateConverter using a given DateFormat.

Parameters:
dateFormat - the DateFormat to use for parsing and formatting dates.
Method Detail

toPhysicalValue

public String toPhysicalValue(Date virtualValue)
Converts a virtual representation of a value into it's physical value.

Specified by:
toPhysicalValue in interface TypeConverter<String,Date>
Parameters:
virtualValue - the virtual representation
Returns:
the physical value

toVirtualValue

public Date toVirtualValue(String physicalValue)
Converts a physical value into it's virtual representation.

Specified by:
toVirtualValue in interface TypeConverter<String,Date>
Parameters:
physicalValue - the physical value
Returns:
the virtual representation


Copyright © 2007-2013. All Rights Reserved.