autobean

Parsing JSON objects of unknown type with AutoBean on GWT

廉价感情. 提交于 2019-11-29 04:37:09
My server returns a list of objects in JSON. They might be Cat s or Dog s, for example. When I know that they'll all be Cat s, I can set the AutoBeanCodex to work easily. When I don't know what types they are, though... what should I do? I could give all of my entities a type field, but then I'd have to parse each entity before passing it to the AutoBeanCodex , which borders on defeating the point. What other options do I have? Just got to play with this the other day, and fought it for a few hours, trying @Category methods and others, until I found this: You can create a property of type