Affects Version/s: 1.3
Fix Version/s: 1.3.1
If one is using the @XStreamConverter annotation on a field, XStream seems to ignore @XStreamAsAttribute altogether, and only reacts to an element, not an attribute.
- depends upon
XSTR-489 @XStreamConverter only takes implementations of Converter; should support SingleValueConverters too
Works in head revision.
Set correct fix version.
Fixed for upcoming release.
I'm not seeing the fix.
I've got the following sequence of annotations:
public Calendar _creationTime = Calendar.getInstance();
And I'm seeing the correct conversion of the date using the converter, but it's appearing as a child element instead of an attribute.
Is there something else I'm missing?
I'm using the snapshot jar off a trunk build from today (3/26/2009).
I happen to need an ISO8601 date so I was able to use:
and see this appear as an attribute. It may turn out the server I'm talking to uses a variant of ISO8601 (i.e. bogus) and I'll need to use a custom format. So I'm still curious about this issue.
Ok, I figure out my problem. I was using an example to base my converter on which implemented the Converter interface.
I changed my converter to extend AbstractSingleValueConverter and changed the marshal and unmarshal methods to toString and fromString respectively and it is appearing correctly as an attribute with my custom format.
No wonder, you have to provide a SingleValueConverter to ba able to render a value as attribute. However, this was not possible at all with @XStreamConverter in version 1.3. Next version provides this functionality though.