Re: [json-lib-user] why is JSONObject declared as final?
Brought to you by:
aalmiray
From: Brec C. <br...@6s...> - 2008-11-05 21:14:04
|
The version of the original code that I have from json.org was not marked as final. It's possible I'm using an out of data but I don't think so judging by the current source up online (http://json.org/java/org/json/JSONObject.java ). Using the serialization options is a way to solve the problem but not the only way. Not only that, if there's no value in converting the data from the json object to a bean or POJO then being forced to do it is simply a waste. This would be the case in my situation, I would gain nothing from serializing the data except the addition cost of de- serializing it later. If the data your modeling is naturally a Map (or list) and your input / outputs are both JSON formatted strings then building your entities as extensions of JSONObject is just very clean. Basically you already have your Map structure taken care of and you can simply fill in gaps in the interfaces to your classes. This is, I realize, not a very big deal. I hate to nitpick on it; it simply caught me off guard yesterday. Consider the above food for thought. Thanks for the reply. Brec Carson On Nov 5, 2008, at 3:40 PM, Andres Almiray wrote: > Brec, > > JSONObject is final because it follows the design of the original > code (json.org), I believe you're the first one encountering > frustration because of this decision (which is not final, no pun > intended). Why would you be required to create wrappers for > JSONObject instances in the first place? aren't the serialization > options provided by the library enough to get you up to speed? > > Cheers, > Andres > > ------------------------------------------- > http://jroller.com/aalmiray > http://www.linkedin.com/in/aalmiray > -- > What goes up, must come down. Ask any system administrator. > There are 10 types of people in the world: Those who understand > binary, and those who don't. > To understand recursion, we must first understand recursion. > > > From: Brec Carson <br...@6s...> > To: jso...@li... > Sent: Tuesday, November 4, 2008 2:12:47 PM > Subject: [json-lib-user] why is JSONObject declared as final? > > Why is JSONObject declared as final? > > I just "upgraded" to this json library from it's root library. A > decision that was forced on me by virtue of using couchdb4j (no > offense meant to couchdb4j, that library seems perfectly well designed > and I think also frustrated by this design decision in the json-lib). > I am immediately met w/ the frustration of needing to completely > redesign my entities to be dumb wrappers around a JSONObject instead > of an intuitive extension of one. What gives? I can think of no good > reason for this. As this is a trivial change to make, is there any > hope that a new build can be put out for this? From my previous > experience dealing with open source I already know that I'm shouting > at the rain here and it won't do me any good but I still feel the need > to do it. Sorry for the mini-rant. > > Brec Carson > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win > great prizes > Grand prize is a trip for two to an Open Source event anywhere in > the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > json-lib-user mailing list > jso...@li... > https://lists.sourceforge.net/lists/listinfo/json-lib-user > > |