public class DateConverter extends java.lang.Object implements ValueConverter<java.util.Date>
Dates using a DateFormat object.| Constructor and Description |
|---|
DateConverter(java.text.DateFormat formatter)
Creates a converter that uses the given date formatter/parser.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Date |
convert(java.lang.String value)
Converts the given string value into a Java type.
|
static DateConverter |
datePattern(java.lang.String pattern)
Creates a converter that uses a
SimpleDateFormat with the given date/time pattern. |
java.lang.String |
valuePattern()
Gives a string that describes the pattern of the values this converter expects, if any.
|
java.lang.Class<java.util.Date> |
valueType()
Gives the class of the type of values this converter converts to.
|
public DateConverter(java.text.DateFormat formatter)
formatter - the formatter/parser to usejava.lang.NullPointerException - if formatter is nullpublic static DateConverter datePattern(java.lang.String pattern)
SimpleDateFormat with the given date/time pattern. The date formatter
created is not lenient.pattern - expected date/time patternjava.lang.NullPointerException - if pattern is nulljava.lang.IllegalArgumentException - if pattern is invalidpublic java.util.Date convert(java.lang.String value)
convert in interface ValueConverter<java.util.Date>value - the string to convertpublic java.lang.Class<java.util.Date> valueType()
valueType in interface ValueConverter<java.util.Date>public java.lang.String valuePattern()
date format string.valuePattern in interface ValueConverter<java.util.Date>null if there's nothing interesting here