Problem decoding complex AutoBean
I've managed a simple AutoBean with a list. Now I've a more complex one, and I don't understand what's wrong. My get methods are returning null though the debugger shows the object has data.
The JSON looks like this:
{
"mquery":
{
"screenname":"Index Card",
"fields":
{
"field":[
{"title":"Name", "name":"odname", "value":"*TIFF*"},
{"title":"Date", "name":"oddate", "value":""},
{"title":"Ref #", "name":"odrefnum", "value":""}
]
}
}
}
I have three interfaces:
public interface Field {
String getTitle();
void setTitle(String title);
String getName();
void setName(String name);
String getValue();
void setValue(String value);
}
public interface FieldList {
List<Field> getField();
void setField(List<Field> field);
}
public interface MQuery {
String getScreenname();
void setScreenname(String screenname);
FieldList getFields();
void setFields(FieldList fields);
}
In my bean factory, I have
public interface BeanFactory extends AutoBeanFactory {
...
AutoBean<Field> field();
AutoBean<FieldList> fields();
AutoBean<MQuery> mquery();
}
In my onResponseReceived() method, I call
AutoBean<MQuery> mqueryBean =
AutoBeanCodex.decode(clientFactory.getBeanFactory(),
MQuery.class, response.getText());
MQuery mQuery = mqueryBean.as();
logger.log(Level.INFO, mQuery.getScreenname());
screenName = mQuery.getScreenname();
fieldList = mQuery.getFields().getField();
view.renderFields(fieldList);
When I look at the debugger in Chrome, screenname, etc are populated (in mQuery:this$0:data_0 there is mquery with screenename set and 3 field objects in fields). However mQuery.getScreenname() returns null as does mQuery.getFields().
What am I not seeing here? Could the presence of other AutoBean<>s in my factory (beans that work) be messing me up (do I need a separate factory)?
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home