Details
-
Type: New Feature
-
Status: Closed
-
Priority: Major
-
Resolution: Not A Bug
-
Affects Version/s: 1.3.1
-
Fix Version/s: None
-
Component/s: Core
-
Labels:None
Description
When mapping subtypes, XStream adds a class attribute to identify the class. Often, this is not necessary because the class can be determined from the structure of the XML by a Converter.
The patch attached to this issue adds a new API call 'convertInheritance' that lets a program associate a Converter or SingleValueConverter with a base class and list of subclasses. XStream will not write the class attribute when marshalling those subclasses, and rely on the Converter to determine the correct subclass to create when unmarshalling.
An acceptance test is included.
After having a closer look to the patch, I think that this is actually already available since XStream 1.2 with the aliasType call. It has the same effect.