Details
-
Type: New Feature
-
Status: Closed
-
Resolution: Won't Fix
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
In the following case I might want to have a converter for base, that is also used when I serialize derived.
class base
{
String it
}
class derived extends base
{
String second
}
The base converted might place its members in attributes, while derived (via standard marshaling) will place it in elements:
<derived it="dd">
<second>bla</string>
</derived>
The xml is actually invalid. Do you want the following one?
<derived it="dd">
<second>bla</second>
</derived>
I believe you can get what you want simply creating your own Converter:
public boolean canConvert(Class c)
{ return c.isAssignableFrom(base.class); }Therefore any extending class from base will get converted using this converter.
Does it solve your problem?