Tuesday, August 20, 2013

Re: Problem decoding complex AutoBean



On Tuesday, August 20, 2013 1:47:58 PM UTC+2, Thad Humphries wrote:
Thank you, Thomas. That worked.

I added the interface

public interface MQueryWrapper {
  MQuery getMquery();
}

In BeanFactory, I changed "AutoBean<MQuery> mquery();" for "AutoBean<MQueryWrapper> mquery();"

My onResponseReceived() now looks like

  AutoBean<MQueryWrapper> bean = 
      AutoBeanCodex.decode(clientFactory.getBeanFactory(), MQueryWrapper.class, 
          response.getText());
  MQuery mQuery = bean.as().getMquery();
  logger.log(Level.INFO, mQuery.getScreenname());
  screenName = mQuery.getScreenname();
  fieldList = mQuery.getFields().getField();
  view.renderFields(fieldList);

Client-side this beats overlay types because it can handle nested objects (so long as I figure out nesting).

Why wouldn't you be able to do it with JSOs?
 
I've not tried it server-side yet, but that looks very handy.

Yup, I'm using it to serialize some data that I output in the host page and load on the client-side at startup, works great and you're sure that your JSON will be understood by the end and don't fear forgetting to update the code on one side and not the other.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment