Morpher
, ObjectMorpher
public final class DateMorpher extends AbstractObjectMorpher
This morpher will iterate through the supplied formats until one succeeds or the default value is returned (if default value is configured).
Constructor | Description |
---|---|
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) |
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(Object obj) |
|
Date |
getDefaultValue() |
Returns the default value for this Morpher.
|
int |
hashCode() |
|
Object |
morph(Object value) |
Morphs the input object into an output object of the supported type.
|
Class |
morphsTo() |
Returns the target Class for conversion.
|
void |
setDefaultValue(Date defaultValue) |
Sets the defaultValue to use if the value to be morphed is null.
|
boolean |
supports(Class clazz) |
Returns true if the Morpher supports conversion from this Class.
Supports any type that is not an Array. |
isUseDefault, setUseDefault
public DateMorpher(String[] formats)
formats
- a list of formats this morpher supports.public DateMorpher(String[] formats, boolean lenient)
formats
- a list of formats this morpher supports.lenient
- if the parsing should be lenient or not.public DateMorpher(String[] formats, Date defaultValue)
formats
- a list of formats this morpher supports.defaultValue
- return value if the value to be morphed is null.public DateMorpher(String[] formats, Date defaultValue, Locale locale, boolean lenient)
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.public DateMorpher(String[] formats, Locale locale)
formats
- a list of formats this morpher supports.locale
- the Locale used to parse each format.public Date getDefaultValue()
public Object morph(Object value)
ObjectMorpher
value
- The input value to be morphedpublic Class morphsTo()
Morpher
public void setDefaultValue(Date defaultValue)
defaultValue
- return value if the value to be morphed is nullpublic boolean supports(Class clazz)
AbstractObjectMorpher
supports
in interface Morpher
supports
in class AbstractObjectMorpher
clazz
- the source ClassCopyright © 2006–2019. All rights reserved.