public class DateConverter extends Object implements SimpleTypeConverter
Date
objects.SimpleDateFormat
,e. g.
""dd.MM.yyyy".
It is thread-safe (the access to the non-thread-safe SimpleDateFormat
is synchronized).
Modifier | Constructor and Description |
---|---|
protected |
DateConverter(SimpleTypeConverterConfiguration configuration)
Constructs a new
DateConverter .If no format is given, the default format (see getDefaultFormat() ) is used. |
Modifier and Type | Method and Description |
---|---|
static DateConverter |
create(SimpleTypeConverterConfiguration configuration)
Constructs a
DateConverter .If no format is given, the default format (see getDefaultFormat() ) is used. |
Date |
fromString(String value)
Converts the given
String object into an object with the simple data type this converter is
intended for. |
protected String |
getDefaultFormat()
Returns the default format which is used when no format is given.
|
String |
toString(Object value)
Converts the given value to a
String object. |
protected DateConverter(SimpleTypeConverterConfiguration configuration)
DateConverter
.getDefaultFormat()
) is used.configuration
- the configurationConversionException
- if the given format is not valid.public static DateConverter create(SimpleTypeConverterConfiguration configuration)
DateConverter
.getDefaultFormat()
) is used.configuration
- the configurationConversionException
- if the given format is not valid.public final Date fromString(String value)
String
object into an object with the simple data type this converter is
intended for.fromString
in interface SimpleTypeConverter
value
- the String
object to convertpublic final String toString(Object value)
String
object.toString
in interface SimpleTypeConverter
value
- the value to convertprotected String getDefaultFormat()
Copyright © 2014. All rights reserved.