XStream
  1. XStream
  2. XSTR-296

Ability to not write empty collections

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Guessing you'll either want to add more to this patch or you'll chose to apply only part of the patch – course applying none of it is a distinct possibility

      Anyway, this patch does three things really:
      – Simple extra constructor to XStream to allow for just a Mapper to be passed in.
      – Allows shouldSerializeMember methods to evaluate the value of the field rather than just the aliasName[1] and definedIn.
      – Mapper for optionally skipping empty collections. If you choose to take this, you may want it to be configurable on field basis. Happy to add that or anything else you want.

      [1] BTW, did you know the parameter names typically used for shouldSerializeMember are wrong. It's signature is typically (Class definedIn, String fieldName), when in fact the only place to invoke it in a non delegated fashion (AbstractReflectionConverter) actually passes in aliasName in leu of fieldName. Not sure if there is something I am missing.

        Issue Links

          People

          • Assignee:
            Unassigned
            Reporter:
            David Blevins
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: