вторник, 18 августа 2015 г.

Recent read books

Just to track my reading list. Here are what I have finished reading recently:
  1. How to Stop Sucking and Be Awesome Instead
  2. Effective Programming: More Than Writing Code
Both books has been written by Jeff Atwood, the creator of StackOverflow. He is great at writing and has spacious mind. Just read the TOC and see if you want to read that books.

понедельник, 10 августа 2015 г.

GWT 2.7.0. Deserialize json on server with Autobean framework

One can use JSON libraries to deserialize json to POJO. How to do it with GWT?

GWT ships with Autobean framework. It allows you to serialize the json on client. But, we can use it on the server side too.

Here is the magic:
1) define the the interface which extends the AutoBeanFactory
2) on the server side use beanFactory = AutoBeanFactorySource.create(Your_Factory_class.class);

AutoBeanFactorySource is in com.google.web.bindery.autobean.vm.AutoBeanFactorySource package. One clue is that it is experimental. So check how it is working in your environment.

3) To decode json to POJO use:
AutoBean<Your_POJOInterface> bean = AutoBeanCodex.decode(
                    beanFactory, Your_POJOInterface.class, jsonString);
Your_POJOInterface requestObject = bean.as();

4) That is all! Just plain GWT and no other special mappers!

четверг, 6 августа 2015 г.

Check GWT and SmartGWT versions in project

You have a GWT & SmartGWT project.  How to check the version of this jar libs in project?

For the GWT version open the *.cache.* file and see the *$gwt_version* variable.

As for SmartGWT see the class com.smartgwt.client.Version class.