org.gvsig.tools.dataTypes.impl.coercion
Class AbstractCoerceToDate

java.lang.Object
  extended by org.gvsig.tools.dataTypes.impl.coercion.AbstractCoerceToDate
All Implemented Interfaces:
DataTypesManager.Coercion
Direct Known Subclasses:
CoerceToDate, CoerceToDateTime, CoerceToTime

public abstract class AbstractCoerceToDate
extends Object
implements DataTypesManager.Coercion

Abstract implementation for Date coercion classes. If the value is not a Date, it will use the Object.toString() method to convert the resulting String to a Date object.

Version:
$Id$
Author:
gvSIG Team

Constructor Summary
AbstractCoerceToDate()
           
 
Method Summary
 Object coerce(Object value)
           
protected abstract  DateFormat createFormatter()
          Returns the DateFormat to apply when the value to coerce is not of Date type and it will be parsed as String.
protected abstract  String getDateType()
          Returns the name of the Date type being coerced.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCoerceToDate

public AbstractCoerceToDate()
Method Detail

coerce

public Object coerce(Object value)
              throws CoercionException
Specified by:
coerce in interface DataTypesManager.Coercion
Throws:
CoercionException

createFormatter

protected abstract DateFormat createFormatter()
Returns the DateFormat to apply when the value to coerce is not of Date type and it will be parsed as String.

Returns:
the DateFormat to apply to parse the value to coerce as String

getDateType

protected abstract String getDateType()
Returns the name of the Date type being coerced. Ex: Date, DateTime, Time. Only used for description when an error is produced when coercing the value.

Returns:
the name of the Date type being coerced


Copyright © 2004-2011 gvSIG. All Rights Reserved.