With the factory created I'm not getting any json data decoded. The
decoded type is something
like ipt.tas.app.ui.gwt.client.IPayloadAutoBean$2@2dbb24d0 instead of the
expected IPayload. I'm not sure what this is ...but all of the data
that IPayload's methods should have contained is null.
However that was with, on the server, the data being encoded into JSON
using Gson, e.g.
Gson gson = new Gson();
String asJson = gson.toJson(str);
I figured that maybe the AutoBeans framework requires that it be used to
encode the data if its being used to decode the data so I replaced the
server code with:
AutoBean<IPayload> bean = AutoBeanUtils.getAutoBean(payload);
String asJson = AutoBeanCodex.encode(bean).getPayload();
However bean is always null so this doesn't work either. I don't see a way
to specify the same factory when encoding (like used when decoding). So
I'm at a lost how to use AutoBean, there are no compile time errors or
warnings just doesn't work at runtime with no obvious reason. It seems
AutoBean can't encode or decode my domain objects.
I'm at a loss on how to convert my domain objects into JSON using GWT.
-Dave
On Friday, October 19, 2012 8:54:24 AM UTC-6, Thomas Broyer wrote:
>
>
>
> On Friday, October 19, 2012 4:20:58 PM UTC+2, dhoffer wrote:
>>
>> Thanks that really helps. Is just defining the top level interface
>> enough, e.g.
>>
>> interface MyAutoBeanFactory extends AutoBeanFactory {
>> AutoBean<IPayload> payload();
>> }
>>
>> Or would I need to include factory methods for all nested interfaces
>> contained/referenced by IPayload?
>>>
>>>
>>>
> AutoBeans cannot decode a IPayload if it doesn't know how to decode a
> IGWTMessage, so obviously dependencies are resolved transitively, and it's
> enough to just reference IPayload here.
>
--
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/-/pxDOf90Jp-sJ.
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.