Wednesday, August 31, 2011

Aw: Re: HTML5 local object persistence for GWT

I started Piriti as an XML mapper for GWT back in January 2010. JSON mapping was introduced some months later. So it has no relation to AutoBeans. It's just an alternative way to (de)serialize POJOs. Although the output is very similar, Piriti is not based on marker interfaces, but real POJOs. See also http://code.google.com/p/piriti/wiki/Comparison for a comparison with other mappers.

The idea off hooking into graph traversal is an interesting concept. I would suggest events and handlers to get notified when a model / property is written to JSON resp. read from JSON:

public interface JsonWriter<T> {
   ...
   HandlerRegistration addWriteModelHandler(WriteModelHandler<T> handler);
   HandlerRegistration addWritePropertyHandler(WritePropertyHandler<?> handler);
   ...
}

public interface WriteModelHandler<T> extends EventHandler {
   void onBeforeWriteModel(WriteModelEvent<T> event);
   void onAfterWriteModel(WriteModelEvent<T> event);
}

public interface WritePropertyHandler<T> extends EventHandler {
   void onBeforeWriteProperty(WritePropertyEvent<T> event);
   void onAfterWriteProperty(WritePropertyEvent<T> event);
   void onSkipProperty(WritePropertyEvent<T> event);
}

What do you think? 

- Harald

--
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/-/YtYiFPLwe28J.
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