Friday, June 3, 2011

Re: Hierachy of autobean for state serialization

Thanks for posting this, Panam. I was just starting to consider using
AutoBean with LocalStorage, since storing a JSON string seems like the
best solution than rolling my own custom serializer. I haven't gotten
too far into it beyond some simple test cases.

For 2), I seem to recall seeing that polymorphism for AutoBean is an
eventual goal for the GWT group, but 2.3 doesn't support it.

For 1), my thoughts would either be on using AutoBeanVisitor (which
can only see things already explicitly added, so probably not) or a
generator (which might trip up AutoBean's generator), but I haven't
tried either in the way you describe, so maybe I'm wrong.

I think the official way is to have an interface for each subclass in
your AutoBeanFactory, so for example:

public interface Base {
getName() / setName()
}

public class BaseImpl implements Base { ... }

public interface Color extends Base {
getColor() / setColor()
}

public class ColorImpl extends BaseImpl implements Color { ... }

public interface Serializer extends AutoBeanFactory {
AutoBean<Base> wrap(Base wrap);
AutoBean<Color> wrap(Color wrap);
}

That works if you only have a small handful of subclasses, but it gets
progressively worse the more you add.

On Jun 2, 3:48 am, Panam <pandem...@googlemail.com> wrote:
> Hm, I am just looking for a way to enocde and persist (webstore) state
> (some POJO properties) on the client.
> I have difficulties to see see how the RequestFactory will help me
> here as my intention is that it is for client server communication.
> However, it ought to be possible (at least, it has to do serialization
> to put the data on the wire).
> As I understand autobeans, they are that part of the bindery framework
> that is used for this purpose (amongst all by the request factory
> itself). That's why I am trying to use them here.
>
> Regards,
> panam

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment