On Tuesday, March 20, 2012 10:55:37 AM UTC+1, Konstantin Solomatov wrote:
I am investigating the usage of gwt autobean in my projects. When I was reading about this component, I came across a concept of autobean wrapping but found neither explanation why it was created nor examples of how to use it. What is it good for? Where can I use it?
It's useful to serialize/deserialize to/from JSON into an existing instance implementing your interface, where that instance can be an AutoBean or an instance of a concrete class (or whatever) implementing your interface. Your object could, for example, be a JPA, JDO or Objectify entity, and by extracting an interface out of the concrete class, you can then easily serialize it to JSON *and* use that same interface on the client side (otherwise, you could have just used GSON or similar).
It could be useful too, I guess, for visiting the properties of an object: if the object implements an interface, you can create a wrapping AutoBean using that interface and then use an AutoBeanVisitor; though I cannot find a real use-case for that.