org.directwebremoting.convert
Class DateConverter

java.lang.Object
  extended by org.directwebremoting.convert.BaseV20Converter
      extended by org.directwebremoting.convert.DateConverter
All Implemented Interfaces:
Converter

public class DateConverter
extends BaseV20Converter
implements Converter

An implementation of Converter for Dates.

Version:
$Id: StringConverter.java,v 1.2 2004/11/04 15:54:07 joe_walker Exp $
Author:
Joe Walker [joe at eireneh dot com]

Constructor Summary
DateConverter()
           
 
Method Summary
 java.lang.Object convertInbound(java.lang.Class paramType, InboundVariable iv, InboundContext inctx)
          Attempt to coerce the data from a string to an Object.
 OutboundVariable convertOutbound(java.lang.Object data, OutboundContext outctx)
          Return a javascript string that defines the variable named varName to have the contents of the converted object data.
 
Methods inherited from class org.directwebremoting.convert.BaseV20Converter
setConverterManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.directwebremoting.extend.Converter
setConverterManager
 

Constructor Detail

DateConverter

public DateConverter()
Method Detail

convertInbound

public java.lang.Object convertInbound(java.lang.Class paramType,
                                       InboundVariable iv,
                                       InboundContext inctx)
                                throws MarshallException
Description copied from interface: Converter
Attempt to coerce the data from a string to an Object. If anything goes wrong with inbound conversion then we generally throw an exception because we are converting data from the untrusted internet so we take the assumption that anything wrong is someone hacking.

Specified by:
convertInbound in interface Converter
Parameters:
paramType - The type to convert to
iv - The data to convert
inctx - The map of data that we are working on
Returns:
The convered data, or null if the conversion was not possible
Throws:
MarshallException - If the conversion failed for some reason

convertOutbound

public OutboundVariable convertOutbound(java.lang.Object data,
                                        OutboundContext outctx)
                                 throws MarshallException
Description copied from interface: Converter
Return a javascript string that defines the variable named varName to have the contents of the converted object data.

In contrast to convertInbound() failures in converting data on the way out should not stop processing, and we should carry on if we can. Failures are probably down to some misconfiguration so as much information about the error as can be safely generated to console logs is good. In other words if you need to loop in outbound conversion then it might be a good idea to catch issues inside the loop, log, and carry on.

Specified by:
convertOutbound in interface Converter
Parameters:
data - The data to convert
outctx - A collection of objects already converted and the results
Returns:
The OutboundVariable that represents the data to convert
Throws:
MarshallException - If the conversion failed for some reason