Json4g And What Can Be Done With Parameterized Types

39 views
Skip to first unread message

Alexey Frishman

unread,
Nov 4, 2010, 1:10:00 PM11/4/10
to GWT-Ent Developer Forum
Hi, dear GWT-Ent developers. I created a library Json4g for easy
serialization to/from JSON in GWT https://code.google.com/p/json4g/
based on GWT-Ent reflection capabilities.

Among other features, this library serializes Collections and Maps.
The problem is that GWT-Ent doesn't store any information about
generic parameters of classes. In standard Java reflection you can do

MyClass.class.getField("stringList").getGenericType()

to obtain field generic parameter in runtime. Currently to get this
information I use

@XmlElement(type=String.class)
List<String> stringList;

Can I hope it will be added to default available reflection
information in GWT-Ent? May be I can help with the actual development
of this feature?

Thanks!

James Luo

unread,
Nov 4, 2010, 6:40:59 PM11/4/10
to gwt...@googlegroups.com
Dear Alexey

  Thank you very much for choose GWTENT :)

  We are under a full refactor of GWTENT and we will support Generic soon, you can have a look the source code in our truck, for example: http://code.google.com/p/gwt-ent/source/browse/trunk/gwtent/src/main/java/com/gwtent/reflection/client/ParameterizedType.java

  For json4g, I think that's a great project, I had try to write a JSON library like you before, but really didn't got enough time, now I think maybe it's the time I can remove the code from gwtent now :D
  Before I remove it, maybe you are interesting some of the code, you can have a look the URL if you have time: "http://code.google.com/p/gwt-ent/source/browse/#svn/trunk/gwtent/src/main/java/com/gwtent/serialization"
  I think other feature you may interesting, please have a look annotation DataContract in "http://code.google.com/p/gwt-ent/source/browse/trunk/gwtent/src/main/java/com/gwtent/serialization/client/DataContract.java". This annotation has a "@Reflect_Full", gwt support meta annotation(if the name is right), so maybe you can create your annotation, but with GWTENT reflection annotation on it, so that will make more sense to json4g user and potentially you can move out from GWTENT :D

  Hope this helps.

Regards
James


--
You received this message because you are subscribed to the Google Groups "GWT-Ent Developer Forum" group.
To post to this group, send email to gwt...@googlegroups.com.
To unsubscribe from this group, send email to gwt-ent+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gwt-ent?hl=en.




--
Regards
James Luo

Alexey Frishman

unread,
Nov 5, 2010, 3:49:23 AM11/5/10
to GWT-Ent Developer Forum
James,

Sounds great that your project evolves! I think it's one of the most
interesting libraries for GWT. I'm looking forward to see generic
types available in reflection information.

About own annotation for json4g - sounds really interesting, thanks
for the idea! It may help to decouple users from one dependency on GWT-
Ent, if they use only json4g (certainly if they don't use GWT-Ent's
other features themselves).

I will obviously look at the code you point me to on weekend. I like
GWT-Ent very much, and if I can somehow help your development -
please, let me to know.

On Nov 5, 12:40 am, James Luo <jamesluo...@gmail.com> wrote:
> Dear Alexey
>
>   Thank you very much for choose GWTENT :)
>
>   We are under a full refactor of GWTENT and we will support Generic soon,
> you can have a look the source code in our truck, for example:http://code.google.com/p/gwt-ent/source/browse/trunk/gwtent/src/main/...
>
>   For json4g, I think that's a great project, I had try to write a JSON
> library like you before, but really didn't got enough time, now I think
> maybe it's the time I can remove the code from gwtent now :D
>   Before I remove it, maybe you are interesting some of the code, you can
> have a look the URL if you have time: "http://code.google.com/p/gwt-ent/source/browse/#svn/trunk/gwtent/src/...
> "
>   I think other feature you may interesting, please have a look annotation
> DataContract in "http://code.google.com/p/gwt-ent/source/browse/trunk/gwtent/src/main/...".
> This annotation has a "@Reflect_Full", gwt support meta annotation(if the
> name is right), so maybe you can create your annotation, but with GWTENT
> reflection annotation on it, so that will make more sense to json4g user and
> potentially you can move out from GWTENT :D
>
>   Hope this helps.
>
> Regards
> James
>
> On Fri, Nov 5, 2010 at 4:10 AM, Alexey Frishman
> <alexey.frish...@gmail.com>wrote:
>
>
>
> > Hi, dear GWT-Ent developers. I created a library Json4g for easy
> > serialization to/from JSON in GWThttps://code.google.com/p/json4g/
> > based on GWT-Ent reflection capabilities.
>
> > Among other features, this library serializes Collections and Maps.
> > The problem is that GWT-Ent doesn't store any information about
> > generic parameters of classes. In standard Java reflection you can do
>
> > MyClass.class.getField("stringList").getGenericType()
>
> > to obtain field generic parameter in runtime. Currently to get this
> > information I use
>
> > @XmlElement(type=String.class)
> > List<String> stringList;
>
> > Can I hope it will be added to default available reflection
> > information in GWT-Ent? May be I can help with the actual development
> > of this feature?
>
> > Thanks!
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "GWT-Ent Developer Forum" group.
> > To post to this group, send email to gwt...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > gwt-ent+u...@googlegroups.com<gwt-ent%2Bunsu...@googlegroups.com>
> > .
Reply all
Reply to author
Forward
0 new messages