Issue Type: Bug Bug
Affects Versions: 1.4.4
Assignee: Jörg Schaible
Components: Converters
Created: 01/Jul/13 9:56 PM
Description:

See the following code snippet

Enum Symbology {RIC, ISIN};

@XStreamAlias("view")
@XStreamConverter(value = ToAttributedValueConverter.class, strings ={"Underlying"})
public class UnderlyingView {
  @XStreamAsAttribute public Symbology symbology;
  public String Underlying;
}

Whenever this class is converted to XML (irrespective of driver) the output is as follows <view>RICunderlying1</view>(with below simple groovy snippet):

XStream xStream = new XStream()
UnderlyingView un = new UnderlyingView([symbology: "RIC", Underlying: "underlying1"])
println xStream.toXML(un)

The text content is all fine, however the attribute, which is an enum is lost, and merged into the text node. It is also possible to deserialize a properly formatted XML {{<view symbology="RIC">Underlying1</view>}}into this view.

From looking at the code for ToAttributedValueConverter it only works properly if the converter in use is a SingleValueConverter. However XStream is using EnumConverter for the enum, and not EnumSingleValueConverter.

Project: XStream
Priority: Major Major
Reporter: Tamas Farago
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to