AutoBeanUtils.getAutoBean(payload); will only return an AutoBean<IPayload> instance if the method parameter already belongs to an AutoBean (see JavaDoc).
So things would look like the following (from memory, hopefully its correct): //GWT client side MyAutoBeanFactory factory = GWT.create(MyAutoBeanFactory.class); //JVM = server side MyAutoBeanFactory factory = AutoBeanFactorySource.create(MyAutoBeanFactory.class); // now following code is the same on GWT client side and JVM/server side // creates a new empty AutoBean AutoBean<IPayload> payloadAutoBean = factory.getPayload(); // creates a new AutoBean that contains the same data as the provided parameter AutoBean<IPayload> payloadAutoBean = factory.getPayload(yourPayloadPojoThatImplementsIPayload); // Optional: Modify / get data from your bean IPayload payload = payloadAutoBean.as(); payload.setData(...); // serialize // If you still have access to payloadAutoBean then use it String json = AutoBeanCodex.encode(payloadAutoBean).getPayload(); // If you dont have access to payloadAutoBean but only to IPayload (maybe you are in a different method) // and you know 'payload' comes from an AutoBean AutoBean<IPayload> bean = AutoBeanUtils.getAutoBean(payload); String json = AutoBeanCodex.encode(bean).getPayload(); // deserialize AutoBean<IPayload> deserializedAutoBean = AutoBeanCodex.decode(factory, IPayload.class, json); IPayload deserializedPayload = deserializedAutoBean.as(); I hope that helps. -- J. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/9Q1MicpiDeYJ. 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.
