net.sf.ezmorph.object
Class DateMorpher

java.lang.Object
  extended by net.sf.ezmorph.object.AbstractObjectMorpher
      extended by net.sf.ezmorph.object.DateMorpher
All Implemented Interfaces:
Morpher, ObjectMorpher

public class DateMorpher
extends AbstractObjectMorpher

Morphs a String to a Date.

This morpher will iterate through the supplied formats until one succeeds or the default value is returned (if default value is condigured).

Author:
Andres Almiray

Constructor Summary
DateMorpher(java.lang.String[] formats)
           
DateMorpher(java.lang.String[] formats, java.util.Date defaultValue)
           
DateMorpher(java.lang.String[] formats, java.util.Date defaultValue, java.util.Locale locale, boolean lenient)
           
DateMorpher(java.lang.String[] formats, java.util.Locale locale, boolean lenient)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.util.Date getDefaultValue()
           
 int hashCode()
           
 java.lang.Object morph(java.lang.Object value)
          Morphs the input object into an output object of the supported type.
 java.lang.Class morphsTo()
           Returns the target Class for conversion.
 void setDefaultValue(java.util.Date defaultValue)
           
 boolean supports(java.lang.Class clazz)
           Returns true if the Morpher supports conversion from this Class.
 
Methods inherited from class net.sf.ezmorph.object.AbstractObjectMorpher
isUseDefault, setUseDefault
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateMorpher

public DateMorpher(java.lang.String[] formats)

DateMorpher

public DateMorpher(java.lang.String[] formats,
                   java.util.Date defaultValue)

DateMorpher

public DateMorpher(java.lang.String[] formats,
                   java.util.Date defaultValue,
                   java.util.Locale locale,
                   boolean lenient)

DateMorpher

public DateMorpher(java.lang.String[] formats,
                   java.util.Locale locale,
                   boolean lenient)
Method Detail

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getDefaultValue

public java.util.Date getDefaultValue()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

morph

public java.lang.Object morph(java.lang.Object value)
Description copied from interface: ObjectMorpher
Morphs the input object into an output object of the supported type.

Parameters:
value - The input value to be morphed

morphsTo

public java.lang.Class morphsTo()
Description copied from interface: Morpher

Returns the target Class for conversion.

Returns:
the target Class for conversion.

setDefaultValue

public void setDefaultValue(java.util.Date defaultValue)

supports

public boolean supports(java.lang.Class clazz)
Description copied from interface: Morpher

Returns true if the Morpher supports conversion from this Class.

Parameters:
clazz - the source Class
Returns:
true if clazz is supported by this morpher, false otherwise.


Copyright © 2006 null. All Rights Reserved.