XStream

API call to map inherited classes without generating a class attribute

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Major 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.

Activity

Hide
Joerg Schaible added a comment -

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.

Show
Joerg Schaible added a comment - 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.

People

Vote (5)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: