|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter
com.thoughtworks.xstream.converters.basic.DateConverter
public class DateConverter
Converts a java.util.Date to a String as a date format, retaining precision down to
milliseconds. The formatted string is by default in UTC. You can provide a different
TimeZone that is used for serialization or null to use always the
current TimeZone. Note, that the default format uses 3-letter time zones that can be
ambiguous and may cause wrong results at deserialization.
| Constructor Summary | |
|---|---|
DateConverter()
Construct a DateConverter with standard formats and lenient set off. |
|
DateConverter(boolean lenient)
Construct a DateConverter with standard formats and using UTC. |
|
DateConverter(String defaultFormat,
String[] acceptableFormats)
Construct a DateConverter with lenient set off using UTC. |
|
DateConverter(String defaultFormat,
String[] acceptableFormats,
boolean lenient)
Construct a DateConverter. |
|
DateConverter(String defaultFormat,
String[] acceptableFormats,
TimeZone timeZone)
Construct a DateConverter with a given TimeZone and lenient set off. |
|
DateConverter(String defaultFormat,
String[] acceptableFormats,
TimeZone timeZone,
boolean lenient)
Construct a DateConverter. |
|
DateConverter(TimeZone timeZone)
Construct a DateConverter with standard formats, lenient set off and uses a given TimeZone for serialization. |
|
| Method Summary | |
|---|---|
void |
appendErrors(ErrorWriter errorWriter)
Append context information to an ErrorWriter. |
boolean |
canConvert(Class type)
Determines whether the converter can marshall a particular type. |
Object |
fromString(String str)
Unmarshals an Object from its single value representation. |
String |
toString(Object obj)
Marshals an Object into a single value representation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DateConverter()
public DateConverter(TimeZone timeZone)
timeZone - the TimeZone used to serialize the Datepublic DateConverter(boolean lenient)
lenient - the lenient setting of DateFormat.setLenient(boolean)
public DateConverter(String defaultFormat,
String[] acceptableFormats)
defaultFormat - the default formatacceptableFormats - fallback formats
public DateConverter(String defaultFormat,
String[] acceptableFormats,
TimeZone timeZone)
defaultFormat - the default formatacceptableFormats - fallback formats
public DateConverter(String defaultFormat,
String[] acceptableFormats,
boolean lenient)
defaultFormat - the default formatacceptableFormats - fallback formatslenient - the lenient setting of DateFormat.setLenient(boolean)
public DateConverter(String defaultFormat,
String[] acceptableFormats,
TimeZone timeZone,
boolean lenient)
defaultFormat - the default formatacceptableFormats - fallback formatstimeZone - the TimeZone used to serialize the Datelenient - the lenient setting of DateFormat.setLenient(boolean)| Method Detail |
|---|
public boolean canConvert(Class type)
ConverterMatcher
canConvert in interface ConverterMatchercanConvert in class AbstractSingleValueConvertertype - the Class representing the object type to be convertedpublic Object fromString(String str)
SingleValueConverter
fromString in interface SingleValueConverterfromString in class AbstractSingleValueConverterstr - the String with the single value of the Object
public String toString(Object obj)
SingleValueConverter
toString in interface SingleValueConvertertoString in class AbstractSingleValueConverterobj - the Object to be converted
nullpublic void appendErrors(ErrorWriter errorWriter)
ErrorReporterErrorWriter.
appendErrors in interface ErrorReportererrorWriter - the error writer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||