title: AutoBean, Arrays/Lists properties and JSNI
body: <p>I am somehow struggling with Arrays and JSNI in the context of Autobeans.<br>
  In one of my GWT projects I retrieve a data from backend using JSON.<br>
  Once the data is retrieved on the client I want to visualize it using a custom visualization widgets (developed in javascript). </p>
  
  <p>Here are the components: </p>
  
  <p><strong>JSON structure</strong>:</p>
  
  <pre><code>{'ids':[1,2,3,4],'data':[[1.0],[1.0,2.0],[1.0,2.0,3.0] ... ]}
  </code></pre>
  
  <p>Basically I have two datasets in my json payload. <strong>ids</strong> is a array of ints (<code>int[]</code>) and <strong>data</strong> is a array of arrays of floats (<code>float[][]</code>)</p>
  
  <p>There are of course different ways to parse the data on the client. I decided to use AutoBeans. So I defined an interface for my json structure. </p>
  
  <p><strong>AutoBean</strong>:</p>
  
  <pre><code>interface MyData {
     List&lt;Integer&gt; ids;
     List&lt;List&lt;Float&gt;&gt; data;
  }
  </code></pre>
  
  <p>Parsing the data works fine. </p>
  
  <p>My custom visualization widgets has a API function to set the data that looks like this: </p>
  
  <pre><code>function api_setData(ids,data) {
     //ids should be an Array of Ints
     //data should be an array of array of Floats.
  }
  </code></pre>
  
  <p>The problem is that with JSNI I can't use normal Java arrays. I have to use <code>JsArray</code>. </p>
  
  <pre><code>public final native void setData(JsArrayInteger ids,JsArray&lt;JsArrayInteger&gt; data /*-{
         this.api_setData(ids,data);
      }-*/;
  </code></pre>
  
  <p>So I have to convert my AutoBean properties (<strong>data</strong> and <strong>ids</strong>) to JsArray instances. 
  Is there a better/nicer way to do that?</p>
  
  <p>Or maybe I should use <code>JSONParser</code> instead of <code>AutoBeans</code>
  Is that more efficient?</p>