1. XStream
  2. XSTR-409

@XStreamConverter should support fields of type Map


    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: Annotations
    • Labels:


      @XStreamConverter currently works on regular fields and fields of type Collection, essentially taking each element of the collection and converting it using the given converter.

      The same behavior should be exposed for Map fields. An example usage could be:

      public class FirstObject {

      // Expected: use the given converter to marshal the keys of each map entry
      private Map<SecondObject, String> params;

      // Expected: use the given converter to marshal the values of each map entry
      private Map<String, SecondObject> moreParams;

      // Expected: use both converters to marshal a map entry
      private Map<SecondObject, ThirdObject> evenMoreParams;

      Developer mailing list excerpt:

      BB> 2. @XStreamConverter works brilliantly on Lists, allowing me to use my
      BB> custom converter on the elements of the list.
      BB> In a perfect world, I'd like
      BB> to be able to add @XStreamConverter annotations on a Map, too, using
      BB> it to convert the key and / or the value of the Map. This might be
      BB> ambigious but I still wanted to start a discussion on this one.
      GS>> Jira this one also. Can you include examples of what you want working
      GS>> (i.e. testcases?)


        • Assignee:
          Jörg Schaible
          Benjamin Broll
        • Votes:
          1 Vote for this issue
          0 Start watching this issue


          • Created: