A program, sooner or later, must persist or exchange data. In
java data is
stored in memory into objects. Objects are structure with data
Java object can be directly stored or send over the network
serialization and rmi. But serialization uses a binary format and work
with java. This is not the best way to exchange data. For
pourposes, other formats are used to exchange data.
Two common format are xml
and json. Both are text format. Text formats are
easier, because are human
Java does not have out-of-the-box conversion of object into xml or
Writing code to convert object into data (and back) is very boring.
nothing creative in this repetitive task. Librariers are developed
pourpose. Due to static types in java, special api must be
used to browse
object to extract data: reflection or code
can manipulate object at runtime
dinamically. Reflection is quite slow (about
10 time slower compared to
"normal" code). Reflection isn't available in GWT.
generation/enhancement is another option. In this case java code is
generated (or existing bytecode modified) to convert objects. In this case
java beans that maps are generated. Because code is generated,
modified by the programmer (he lost the changes in the next
Another think to consider are the mapping rules. The framework must
how to translate java objects graph into xml or json structures. For
pourpose frameworks uses configuration files (most xml) or java
I am not happy with configuration files or annotations. If the mapping
not match the default rule, you must configure or annotate each
class / each
attribute. Suppose for example the framework map attributes
uppercase and you
need lowecase, sometimes you CAN'T configure
only one default property, but
you must configure each
class/attribute. How easy is to make a tip error? Some
require that you annotate each class that must be converted. Very
annoying! Annotations are framework specific, in case you change
you must replace annotations in source code.
I like to have a java binding framework with the following
Does not uses reflection: I need a fast solution that work with gwt
Because the only alternative in this case is code
generation, I need that
the code generated is source java code
(not bytecode enhancement). Source
code works with gwt and is more
easy to debug.
The generated java source code must not be the beans and the
code, but ONLY the binding code over EXISTING objects.
This way the
re-generation will overwrite the binding code but let me
change the beans
and add business logic without problems.
The mapping rules are not specified by annotation or config file
each class. Java classes must be untouched, they
don't must hold any
mapping informations. A default
configuration file define the set of
classes and default rules that
are applied to all class in the set.
A general java object set is a graph while xml and json are
structures. The framework must support object graph (object
Java classes uses inheritance. I can save a dog into an animal object.
need that event sub-classes are converted properly.
I haven't found such a java binding framework, then I have
Do you need something like this too?