title: JAXB Error with Map
body: <p>I have a logic that requires mashalling/unmashalling of . I am using the metro implementation of jaxws.
  I used the recommendation from Blaise <a href="http://blog.bdoughan.com/2010/07/xmladapter-jaxbs-secret-weapon.html" rel="nofollow">here</a> and it worked for scenarios where my Object data are Strings. For the ones having List as data I noticed, on the client side (over the network), JAXB generated it's own custom ArrayList class that extended custom AbstractList as shown below:</p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "arrayList")
  @XmlSeeAlso({
      CustomFieldMap.class
  })
  public class ArrayList
      extends AbstractList
  {
  
  
  }
  
  @XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "abstractList")
  @XmlSeeAlso({
      ArrayList.class
  })
  public abstract class AbstractList
      extends AbstractCollection
  {
  
  
  }
  
  @XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "abstractCollection")
  @XmlSeeAlso({
      AbstractList.class
  })
  public abstract class AbstractCollection {
  
  
  }
  </code></pre>
  
  <p>I thought the above is a bit weird because, when the client need to consume the ArrayList data, no value is presented, given that it is using the custom ArrayList instead of java.util.ArrayList</p>
  
  <p>My models looks like so:</p>
  
  <pre><code>@XmlSeeAlso( { CFMap.class, CField.class, ArrayList.class } )
  public final class MAdapt
        extends
           XmlAdapter&lt; CFMap, Map&lt; String, Object &gt;&gt;
  {
     @Override
     public CFMap marshal( Map&lt; String, Object &gt; pCField )
           throws Exception
     {
        CFMap vCFMap = new CFMap();
  
        // ignore custom fields having null values
        if( pCField == null )
        {
           return vCFMap;
        }
  
        for( Entry&lt; String, Object &gt; vEntry : pCField.entrySet() )
        {
           CField vCField = new CField();
           vCField.key = vEntry.getKey();
           vCField.value = vEntry.getValue();
           vCFMap.add( vCField );
        }
  
        return vCFMap;
     }
  
     @Override
     public Map&lt; String, Object &gt; unmarshal( CFMap pCFMap )
           throws Exception
     {
        HashMap&lt; String, Object &gt; vHashMap = new HashMap&lt; String, Object &gt;();
  
        if( pCFMap == null )
        {
           return vHashMap;
        }
  
        pCFMap.forEach( p -&gt; vHashMap.put( p.key, p.value ) );
  
        return vHashMap;
     }
  }
  
  
  
  @XmlRootElement
  @XmlAccessorType( XmlAccessType.FIELD )
  @XmlSeeAlso({CField.class, ArrayList.class})
  public class CFMap extends ArrayList&lt; CField &gt;
  {
     private static final long serialVersionUID = 1L;
  
     @XmlElement (name = "cField")
     public List&lt; CField &gt; getCFields()
     {
        return this;
     }
  }
  
  @XmlRootElement
  @XmlSeeAlso( { MAdapt.class, CFMap.class, ArrayList.class } )
  public class CField
  {
     @XmlElement( nillable = true )
     public String key;
  
     @XmlElement( nillable = true )
     public Object value;
  }
  </code></pre>
  
  <p>The usage is:</p>
  
  <pre><code>@XmlRootElement
  public class TestC
  {
      ....
      protected Map&lt; String, Object &gt; csFields;
  
      @XmlElement( name = "cfields" )
      @XmlJavaTypeAdapter( MAdapt.class )
      public Map&lt; String, Object &gt; getCsFields()
      {
        return customFields;
      }
  }
  </code></pre>