i'm interested in this, too... :)
On 14 Okt., 21:09, alexp <[email protected]> wrote: > Assume I the following JSON: > > [ > { "foo": 1, "bar": 2 }, > { "foo": 3, "bar": 4 } > ] > > How would I set up my AutoBean and factory to parse this? > > If the array were a child of another object, like this: > > { "items": [ > { "foo": 1, "bar": 2 }, > { "foo": 3, "bar": 4 } > ] > > } > > Then the AutoBean would be easy, because the array is identified by > the enclosing object: > > interface Foo { > List<Item> items; > > } > > interface Item { > int getFoo(); > int GetBar(); > > } > > However, when the array is at the root, there doesn't seem a way to > decode a list at the root. In other words, I cannot do this: > > MyFactory { > List<Item> itemList(); > > } > > Because I would not be able to specify List<Item> as the cass (e.g. > type) to be decoded: > > AutoBean<List<Item> bean = AutoBeanCodex.decode(myFactory, ???.class, > jsonString); > > I tried adding a list bean that extended list, like this: > > interface ItemList extends List<Item> { > > } > > But I quickly realized that the AutoBean code would try to look for > JSON properties or Category methods for all the methods in the List > interface. > > Any ideas? > > Thanks in advance, > > Alex -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
