List<List<MyEnum>> in AutoBeanFactory
I'm using an AutoBeanFactory outside of RequestFactory to transform objects to and from JSON. It's working really well, but I've just added a type of Object that is crashing the codex with a NullPointerException and I'm not sure why.
I'm using GWT 2.2.0.
The object class:
public interface Policy
{
public List<List<MyEnum&g开发者_Go百科t;> getListsOfEnums();
public void setListsOfEnums(List<List<MyEnum>> listOfLists);
}
The factory class:
public interface MyAutoBeanFactory extends AutoBeanFactory
{
public AutoBean<Policy> policy();
}
When I call AutoBeanCodex.encode(anInstanceOfAnImplementationOfPolicy)
, I get a NullPointerException:
Caused by: java.lang.NullPointerException
at com.google.gwt.autobean.shared.AutoBeanCodex$Encoder.encodeToStringBuilder(AutoBeanCodex.java:407)
at com.google.gwt.autobean.shared.AutoBeanCodex$Encoder.visitCollectionProperty(AutoBeanCodex.java:310)
at com.activegrade.shared.data.overallgradingpolicy.OverallGradingPolicyAutoBean.traverseProperties(OverallGradingPolicyAutoBean.java:264)
at com.google.gwt.autobean.shared.impl.AbstractAutoBean.traverse(AbstractAutoBean.java:153)
at com.google.gwt.autobean.shared.impl.AbstractAutoBean.accept(AbstractAutoBean.java:112)
at com.google.gwt.autobean.shared.AutoBeanCodex.encodeForJsoPayload(AutoBeanCodex.java:546)
at com.google.gwt.autobean.shared.AutoBeanCodex.encode(AutoBeanCodex.java:537)
... (my code)
It seems like the AutoBeanCodex should make another call to visitCollectionProperty, so maybe this is a bug worthy of an issue with Google. On the other hand, maybe I'm doing something wrong, or this is expressly not supported.
I'm hoping someone has some experience with this, or that BobV has a suggestion :)
Support for serialization of arbitrary parameterized collections was added after GWT 2.2 was branched. This should work in the 2.3 release branch or on trunk.
精彩评论