public class DateConverter extends NumberConverter
DateFormats
, to avoid
creation and parsing of date formats every time one is used.Constructor and Description |
---|
DateConverter()
Creates a
DateConverter |
Modifier and Type | Method and Description |
---|---|
Object |
toObject(String pString,
Class pType,
String pFormat)
Converts the string to a date, using the given format for parsing.
|
String |
toString(Object pObject,
String pFormat)
Converts the object to a string, using the given format
|
getFormat
public Object toObject(String pString, Class pType, String pFormat) throws ConversionException
toObject
in interface PropertyConverter
toObject
in class NumberConverter
pString
- the string to convert.pType
- the type to convert to. java.util.Date
and
subclasses allowed.pFormat
- the format used for parsing. Must be a legal
SimpleDateFormat
format, or null
which will use the
default format.java.util.Date
ConversionException
Date
,
DateFormat
public String toString(Object pObject, String pFormat) throws ConversionException
toString
in interface PropertyConverter
toString
in class NumberConverter
pObject
- the object to convert.pFormat
- the format used for conversion. Must be a legal
SimpleDateFormat
format, or null
which will use the
default format.ConversionException
- if the object is not a subclass of
java.util.Date
Date
,
DateFormat
Copyright © 2017. All rights reserved.