JSON4Brwsr
From APIDesign
JaroslavTulach (Talk | contribs)
(New page: JSON is the standard API for persisting objects in current browsers. In case Java wants to get Bck2Brwsr it needs to play well with JSON. You may think there has been t...)
Next diff →
Revision as of 08:49, 30 April 2013
JSON is the standard API for persisting objects in current browsers. In case Java wants to get Bck2Brwsr it needs to play well with JSON. You may think there has been too many APIs to access JSON from Java created already -- one of them must fit the needs of Bck2Brwsr (and FXBrwsr). Well, it does not. The reason is that for all the previous attempts the assumption was that Java is the base and JSON is built on top of its runtime. In case of the Bck2Brwsr project the situation is up-side-down. JavaScript (and thus also JSON) is naturally supported and Java lives above it.
net.java.html.json
Can the Java to JSON mapping get more simple than this: http://hudson.apidesign.org/hudson/job/bck2brwsr-net.java.html.json/javadoc/ ?
I doubt. With the help of AnnotationProcessors we remove the need to type boiler plate code. Don't bother with getters and setters, don't bother with fields. Just use the @Property annotation and the rest will be generated for you. When you need to talk to server use @OnReceive annotation and you get the result. Type-safe. Reflection-less. Effective.
As the Twitter example shows, with the Java code may in fact the smaller than the same JavaScript one.