Friday, October 19, 2012

Re: How to define AutoBeanFactory?

Have you read http://code.google.com/p/google-web-toolkit/wiki/AutoBean ?
I think this can help to get you started.

On Thursday, October 18, 2012 10:46:32 PM UTC+2, dhoffer wrote:
I'm trying to figure out how to use AutoBeanFactory to decode a JSONString, e.g.

AutoBean<IPayload> autoBean = AutoBeanCodex.decode(myAutoBeanFactory, IPayload.class, jsonValue.stringValue());
IPayload payload = autoBean.as();

What I'm not clear on is how to define myAutoBeanFactory?

I understand that's an interface passed to GWT.create(MyAutoBeanFactory.class), but what methods does MyAutoBeanFactory need?

My IPayload and its content is defined as:

public interface IPayload extends Serializable {
    IGWTMessage[] getMessages();
    void setMessages(IGWTMessage[] messages);
}

public interface IGWTMessage extends IGWTMessage {
    IUUIDReference getMessageId();
    void setMessageId(IUUIDReference id);
}

Then there are about a dozen derived interfaces that extend IGWTMessage and then each of those has its concrete implementation class.

How can I handle this with AutoBeanFactory/JSON?

Btw, this used to be just Serialized and marshaled that way but now I'm trying to use a different approach that requires JSON.  Also, if there was a way to just do a regular Java binary serialization that would be fine too as I could then turn that into a Base64 encoded string and send just that via JSON...then do the reverse on the server.  (But I haven't yet seen a way to do Java binary serialization in the GWT client.) 

Thanks,
-Dave







--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/pc_zKSdHe9YJ.
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate