Re: [Simple-support] Date
Brought to you by:
niallg
|
From: Federico F. <fed...@fi...> - 2007-06-13 18:58:12
|
I've done it the second way
For the record, here is a snipped of what I've coded to serialize a
(quite) complex object model
@Root(name = "something")
public class SomethingXMLAdapter {
public static final SimpleDateFormat DATETIME_FORMAT = new
SimpleDateFormat(
"yyyyMMddhhmm");
private final Something innerSomething;
public SomethingXMLAdapter(Something something) {
this.innerSomething = something;
}
public SomethingXMLAdapter() {
this.innerSomething = new Something();
}
@Element(name = "stop-at")
public String getStopAt() {
return DATETIME_FORMAT.format(innerSomething.getStopAt());
}
@Element(name = "stop-at")
public void setStopAt(String stopAt) throws ParseException {
innerSomething.setStopAt(DATETIME_FORMAT.parse(stopAt));
}
}
|