There are methods in XStream for setting up implicit collections, arrays and
maps that I'm now using. But I want to be able to handle *fields* implicitly
as well. For example:
public class WidgetHolder {
private Widget heldWidget;
}
public abstract class Widget {
}
public class Doohickey extends Widget {
}
public class Thingummy extends Widget {
}
In this case I end up creating XML of the form:
<widgetHolder>
<heldWidget class="doohickey"/>
</widgetHolder>
<widgetHolder>
<heldWidget class="thingummy"/>
</widgetHolder>
What I want to be able to do, though is specify that any instance of type
Widget should be stored in the 'heldWidget' field of WidgetHolder, letting
me write XML in the form:
<widgetHolder>
<thingummy/>
</widgetHolder>
<widgetHolder>
<doohickey/>
</widgetHolder>
I feel sure this should be possible, but can't quite see how to do it
without completely taking control of the conversion of widgetHolder (which I
don't want to do, as its other properties are relatively complex and are
handled nicely by XStream as it stands). I'm probably missing something
obvious - any suggestions?
--
View this message in context:
http://old.nabble.com/Implicit-fields-tp34562688p34562688.html
Sent from the xstream - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email