title: Converting List wrapper to List using JAXB
body: <p>I'm trying to annotate a set of data objects with JAXB binding annotations so that this set of data objects can be properly marshaled as JSON using CXF.  I'm running into an issue with a class that is basically just a wrapper around ArrayList:</p>
  
  <pre><code>class IntegerListWrapper {
      private ArrayList&lt;Integer&gt; integerList;
      ...
  }
  </code></pre>
  
  <p>Some of my data objects refer to this class:</p>
  
  <pre><code>class DataObjectFoo {
      ...
      public IntegerListWrapper getDataIDs() {
          ...
      }
      ...
  }
  </code></pre>
  
  <p>I'm looking for the output to be:</p>
  
  <pre><code>"DataObjectFoo" : {
    "dataIDs" : [1, 2, ..., n] // Array of Data IDs
  }
  </code></pre>
  
  <p>I tried annotating the IDList class itself but it left me with this:</p>
  
  <pre><code>"DataObjectFoo" : {
    "dataIDs" : { "integerList" : [1, 2, ..., n] } // Extra nesting
  }
  </code></pre>
  
  <p>I tried writing an XmlAdapter but got mixed results:</p>
  
  <pre><code>// Throws an error... "Can't bind to interface"
  public final class IDListAdapter extends XmlAdapter&lt;List&lt;Integer&gt;, IDList&gt; {
  // Does not produce any output
  public final class IDListAdapter extends XmlAdapter&lt;ArrayList&lt;Integer&gt;, IDList&gt; {
  // Produces output with extra nesting like above
  public final class IDListAdapter extends XmlAdapter&lt;Integer[]&gt;, IDList&gt;
  </code></pre>
  
  <p>So I have two questions:</p>
  
  <ol>
  <li>How do I get the desired output (without converting IDList to something else in my data objects)?</li>
  <li>Why did the second XmlAdapter (using ArrayList) not produce output?</li>
  </ol>