|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjoptsimple.util.DateConverter
public class DateConverter
Converts values to Date
s using a DateFormat
object.
Constructor Summary | |
---|---|
DateConverter(java.text.DateFormat formatter)
Creates a converter that uses the given date formatter/parser. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DateConverter(java.text.DateFormat formatter)
formatter
- the formatter/parser to use
java.lang.NullPointerException
- if formatter
is null
Method Detail |
---|
public 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 pattern
java.lang.NullPointerException
- if pattern
is null
java.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 convert
public 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |