org.jdesktop.binding.metadata
Class Converters.DateConverter

java.lang.Object
  extended by org.jdesktop.binding.metadata.Converters.DateConverter
All Implemented Interfaces:
Converter
Enclosing class:
Converters

public static class Converters.DateConverter
extends java.lang.Object
implements Converter

Converter for java.util.Date. The format parameter must be either an instance of DateFormat or null. If null is specified, the converter will use the default SimpleDateFormat object, whose format defaults to "EEE MMM dd hh:mm:ss z yyyy".

See Also:
DateFormat, SimpleDateFormat

Constructor Summary
Converters.DateConverter()
           
Converters.DateConverter(java.text.DateFormat defaultInputFormat, java.text.DateFormat defaultOutputFormat)
           
 
Method Summary
 java.lang.Object decode(java.lang.String value, java.lang.Object format)
          Converts the specified String value to an object that is an instance of the class associated with this converter instance.
 java.lang.String encode(java.lang.Object value, java.lang.Object format)
          Converts the specified Object value to a string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Converters.DateConverter

public Converters.DateConverter()

Converters.DateConverter

public Converters.DateConverter(java.text.DateFormat defaultInputFormat,
                                java.text.DateFormat defaultOutputFormat)
Method Detail

encode

public java.lang.String encode(java.lang.Object value,
                               java.lang.Object format)
                        throws ConversionException
Description copied from interface: Converter
Converts the specified Object value to a string representation. The value must be an instance of the class associated with this converter, else an exception will be thrown.

Specified by:
encode in interface Converter
Parameters:
value - the object to be converted
format - object containing string format information, or null if format information is either not relevant or unspecified
Returns:
String containing the converted string representation of the value
Throws:
ConversionException - if the conversion could not be performed

decode

public java.lang.Object decode(java.lang.String value,
                               java.lang.Object format)
                        throws ConversionException
Description copied from interface: Converter
Converts the specified String value to an object that is an instance of the class associated with this converter instance.

Specified by:
decode in interface Converter
Parameters:
value - String object to be converted
format - object containing string format information, or null if format information is either not relevant or unspecified
Returns:
Object which contains the converted value as an instance of the class associated with this converter
Throws:
ConversionException - if the conversion could not be performed


Copyright © 2005 Sun Microsystems All Rights Reserved.