AutoBean polymorphism support

161 views
Skip to first unread message

Andrea Boscolo

unread,
Oct 13, 2012, 6:40:16 AM10/13/12
to google-we...@googlegroups.com
Hi all,
I am developing an app in which I use (or at least I would like to use) AutoBeans for serializing data. Unfortunately it seems to me that polymorphism is not supported i.e., I lost the concrete type once I deserialize the json in client-side, only the Base supertype is available.
I looked everywhere but I haven't found some concrete answer, so I hope someone has already faced (and why not, solved) this problem.
I created a really simple testcase that can be found on https://gist.github.com/3884099

I know AutoBean is behind RequestFactory so I though it supports polymorphism as well. I don't want to rely on RF as I do not need such complexity, I just simply need a way to serialize beans using AutoBean, but polymorphism is a must.

Is is even achievable? Hope someone can help.

Thanks in advance,
Andrew.

Thomas Broyer

unread,
Oct 13, 2012, 7:41:46 AM10/13/12
to google-we...@googlegroups.com
No, AutoBean has no mean to support polymorphism, and it specifically cannot be used for your use-case.
You can possibly use Splittable, at a lower-level, or Elemental's JSON, JS overlays, or JSONObject.

Andrea Boscolo

unread,
Oct 15, 2012, 11:31:51 AM10/15/12
to google-we...@googlegroups.com
Thanks, you confirmed my suspicions.
Are you saying I can use Splittable to achieve polymorphism? How? Have you ever tried?
Of course I can somehow get rid of polymorphism in my classes, but I'd rather do not.

amer qarabsa

unread,
Feb 27, 2014, 7:13:31 AM2/27/14
to google-we...@googlegroups.com
Hi ,
I am facing the same case in which i have to create a generic bean factory , this means that factory related to some super class , and all i have to do is to create sub classes from it and send and parse json data using it,the object coming from parsing json can be  of any subclass of my super class, which from how i understand Auto Bean framework is the opposite of the point of it , so anyone can help me if there is a way , and if there is not please tell me and give me some official resource says its not impossible 
Reply all
Reply to author
Forward
0 new messages