XStream
  1. XStream
  2. XSTR-363

Serialize superclass(es) before subclasses - boolean configuration property

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2.2
    • Component/s: None
    • Labels:
      None

      Description

      See user mailing list "HashCode corrupted on deserialzing map"

      Currently Xstream always serializes subclasses before superclasses. For example:

      public class Person {
      public String name; //getters and setters
      }
      public class Employee extends Person {
      public String address; //getters and setters
      }
      becomes serialized as:
      <Employee>
      <address>street 15</street>
      <name>John Smith</name>
      </Employee>

      Besides the unlogical aesthetic aspect, this corrupts maps in subclasses that use keys based on superclassses (see user list).

      The solution would be a boolean configuration property that enabled/disables superclass serializing before subclass serializing.
      I would even propose to make enable it by default and provide disabling for backwards compability...

        People

        • Assignee:
          Unassigned
          Reporter:
          Geoffrey De Smet
        • Votes:
          1 Vote for this issue
          Watchers:
          2 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: