public class DateConverter extends FormatableConverter<Date>
DateTimeFormat#parse(String) for the
conversion. If no format is given ISO_8601 is used.| Modifier and Type | Field and Description |
|---|---|
protected com.google.gwt.i18n.shared.DateTimeFormat |
dateTimeFormat |
static com.google.gwt.i18n.shared.DateTimeFormat.PredefinedFormat |
DEFAULT_FORMAT |
logger| Constructor and Description |
|---|
DateConverter() |
DateConverter(com.google.gwt.i18n.shared.DateTimeFormat dateTimeFormat) |
DateConverter(String format) |
| Modifier and Type | Method and Description |
|---|---|
Date |
convert(String value)
Converts the specified value to date.
|
protected Date |
convertInternal(String value) |
protected com.google.gwt.i18n.shared.DateTimeFormat |
dateTimeFormat(String format)
Initialization happens in an extra method to enable GWT free unit tests
|
String |
serialize(Date value)
Implementation based on
String.valueOf(Object). |
getFormatisValidpublic static final com.google.gwt.i18n.shared.DateTimeFormat.PredefinedFormat DEFAULT_FORMAT
protected final com.google.gwt.i18n.shared.DateTimeFormat dateTimeFormat
public DateConverter()
public DateConverter(String format)
format - IllegalArgumentException - If the format is an illegal date time formatpublic DateConverter(com.google.gwt.i18n.shared.DateTimeFormat dateTimeFormat)
dateTimeFormat - Must not be null! Otherwise a NullPointerException
will be thrown.NullPointerException - if dateTimeFormat is nullprotected com.google.gwt.i18n.shared.DateTimeFormat dateTimeFormat(String format)
format - public Date convert(String value)
value - The string to be converted. May be null.null if the value is null, empty or in the wrong
format, otherwise the converted datename.pehl.piriti.converter.client.Converter#convert(java.lang.String,
java.lang.String)public String serialize(Date value)
AbstractConverterString.valueOf(Object).serialize in interface Converter<Date>serialize in class AbstractConverter<Date>value - The value to serialize. May be null.null if no value was given.name.pehl.piriti.converter.client.Converter#serialize(java.lang.Object,
java.lang.String)Copyright © 2013 Harald Pehl. All Rights Reserved.