I can't seem to figure out how to tell AutoBeanFactory to encode/ decode lists of objects. I have a simple bean object with string- valued properties, and another bean object which has a list of the first object. When I try to encode, I get a NullPointerException from the AutoBeanCodex implementation. From the documentation in the wiki (http://code.google.com/p/google-web-toolkit/wiki/AutoBean) it appears that this is supposed to work, but what am I doing wrong?
Here is my test case: public class BeanTest extends GWTTestCase { interface MyFactory extends AutoBeanFactory { AutoBean<Thing> thing (); AutoBean<Bunch> bunch (); } interface Thing { // simple bean with one string-valued property String getName (); } interface Bunch { // Simple bean with one List<Thing> valued property List<Thing> getThings (); } public void testThing () { Thing t1 = new Thing() { public String getName() { return "one"; } }; Thing t2 = new Thing () { public String getName () { return "two"; } }; MyFactory fact = GWT.create(MyFactory.class); AutoBean<Thing> encodeBean = fact.create (Thing.class, t1); String json = AutoBeanCodex.encode(encodeBean).getPayload(); System.out.println ("payload: " + json); final Thing [] pair = { t1, t2 }; Bunch b = new Bunch() { public List<Thing> getThings() { return Arrays.asList(pair); } }; AutoBean<Bunch> bunchBean = fact.create (Bunch.class, b); // The following throws NullPointerException :( json = AutoBeanCodex.encode(bunchBean).getPayload(); System.out.println ("payload: " + json); } } -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.