net.sf.ezmorph.object

Class DateMorpher

public final 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 configured).

Author: Andres Almiray

Constructor Summary
DateMorpher(String[] formats)
DateMorpher(String[] formats, boolean lenient)
DateMorpher(String[] formats, Date defaultValue)
DateMorpher(String[] formats, Date defaultValue, Locale locale, boolean lenient)
DateMorpher(String[] formats, Locale locale)
DateMorpher(String[] formats, Locale locale, boolean lenient)
Method Summary
booleanequals(Object obj)
DategetDefaultValue()
Returns the default value for this Morpher.
inthashCode()
Objectmorph(Object value)
ClassmorphsTo()
voidsetDefaultValue(Date defaultValue)
Sets the defaultValue to use if the value to be morphed is null.
booleansupports(Class clazz)

Constructor Detail

DateMorpher

public DateMorpher(String[] formats)

Parameters: formats a list of formats this morpher supports.

DateMorpher

public DateMorpher(String[] formats, boolean lenient)

Parameters: formats a list of formats this morpher supports. lenient if the parsing should be lenient or not.

DateMorpher

public DateMorpher(String[] formats, Date defaultValue)

Parameters: formats a list of formats this morpher supports. defaultValue return value if the value to be morphed is null.

DateMorpher

public DateMorpher(String[] formats, Date defaultValue, Locale locale, boolean lenient)

Parameters: formats a list of formats this morpher supports. defaultValue return value if the value to be morphed is null. locale the Locale used to parse each format. lenient if the parsing should be lenient or not.

DateMorpher

public DateMorpher(String[] formats, Locale locale)

Parameters: formats a list of formats this morpher supports. locale the Locale used to parse each format.

DateMorpher

public DateMorpher(String[] formats, Locale locale, boolean lenient)

Parameters: formats a list of formats this morpher supports. locale the Locale used to parse each format. lenient if the parsing should be lenient or not.

Method Detail

equals

public boolean equals(Object obj)

getDefaultValue

public Date getDefaultValue()
Returns the default value for this Morpher.

hashCode

public int hashCode()

morph

public Object morph(Object value)

morphsTo

public Class morphsTo()

setDefaultValue

public void setDefaultValue(Date defaultValue)
Sets the defaultValue to use if the value to be morphed is null.

Parameters: defaultValue return value if the value to be morphed is null

supports

public boolean supports(Class clazz)
Copyright © 2006-2011. All Rights Reserved.