[json-lib-user] Java 5
Brought to you by:
aalmiray
From: Philippe K. <pke...@oc...> - 2008-03-06 16:44:10
|
Hi, I am new to JSON-lib, may be my question is a newbie answer. I saw that there is a jdk15 version and I’m using it. It seems that this version isn’t really full jdk 5, is there some plan to have more java 5 compliant API? What do it mean? 1) A Generics API public class JSONObject { … public static <T> T toBean( JSONObject jsonObject, Class<T> beanClass, Map classMap ) {…} } 2) An automatic collection mapping based on Generics With such functionality, you example with EZMorph: HYPERLINK "http://json-lib.sourceforge.net/usage.html#From%20JSON%20to%20Beans"http:// json-lib.sourceforge.net/usage.html#From%20JSON%20to%20Beans in the “From JSON to Beans” will become: String json = "{'data':[{'name':'Wallace'},{'name':'Grommit'}]}"; MyBean bean = JSON5Utils.toBean( JSONObject.fromObject(json), MyBean.class, classMap ); Instead of String json = "{'data':[{'name':'Wallace'},{'name':'Grommit'}]}"; Map classMap = new HashMap(); classMap.put( "data", Person.class ); MyBean bean = (MyBean)JSONObject.toBean( JSONObject.fromObject(json), MyBean.class, classMap ); I already have code and tests for that functionalities, are you interesting by It and how do you want it (I can’t give you a patch on you actual project, it only compiles with Java5) ? An independent Maven project? Another and independent question: is there an Svn connection URL instead of the cvs (I found the CVS one, but I can’t succeed in converting it to standard sourceforge Svn url) ? Regards, Philippe Ce message Envoi est certifié sans virus connu (AVG Pro). Analyse effectuée par AVG. Version: 7.5.516 / Base de données virus: 269.21.5/1314 - Date: 05/03/2008 18:38 |