### AutoBeans can be used on client *and* server side:

  static interface MyAutoBeanFactory extends AutoBeanFactory {

    AutoBean<MyPojo> login();

  }


  // In non-GWT code, use AutoBeanFactoryMagic.create(MyFactory.class);

  static final MyAutoBeanFactory FACTORY = GWT.create(MyAutoBeanFactory.
class);



  public MyPojo getMyPojo(String json) {

    AutoBean<MyPojo> bean = AutoBeanCodex.decode(FACTORY, MyPojo.class, 
json);

    return bean.as();

  }


  public String getJson(MyPojo myPojo) {

    AutoBean<MyPojo> bean = AutoBeanUtils.getAutoBean(myPojo);

    return AutoBeanCodex.encode(bean).getPayload();

  }



### JSON Overlay types work on client side only (look at the native 
javascript code /*-{ }-*/):


  public final native T getPojo(String json) /*-{

    return eval(json); // eval('(' + json + ')');

  }-*/;


  public String getJson(T pojo) {

    return new JSONObject(pojo).toString();

  }



### RequestFactory is great above persistence layers like JPA (and uses 
AutoBeans under the hood!) but has a lot of boilerplate code.

### Btw: I generate the RequestFactory + JPA stuff with Xtext + Xpand (using 
a domain specific language (dsl) for my domain model).



- Daniel

-- 
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/-/Lqd-Ks2atkUJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to