XStream
  1. XStream
  2. XSTR-470

allow transient fields to be optionally deserialized

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3
    • Component/s: Converters
    • Labels:
      None

      Description

      It would be nice to be able to optionally allow transient fields to be deserialized. We'd like to use this as part of a deprecation/data migrations strategy.

      If AbstractReflectionConverter had a method like:

      protected boolean shouldDeserializeTransientField(){
      return false
      };

      Then those of us who want this can trivially over-ride that in a customer ReflectionConverter

      There are 2 places in AbstractReflectionConverter where the following code appears :

      if (Modifier.isTransient(field.getModifiers()) {
      reader.moveUp();
      continue;
      }

      It could be easily modified to be

      if (Modifier.isTransient(field.getModifiers() && !shouldDeserializeTransientField) {
      reader.moveUp();
      continue;
      }

      In this way, people could access this functionality with a trivial subclass of ReflectionConverter without any impact on current users or functionality.

      Probably the "correct" way to do it is to put the query method in to the Mapper interface, but this would have more change/impact

        People

        • Assignee:
          Jörg Schaible
          Reporter:
          J. Matthew Pryor
        • Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: