You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2017/02/08 01:21:21 UTC
incubator-juneau-website git commit: Remove parseMap/parseCollection
references.
Repository: incubator-juneau-website
Updated Branches:
refs/heads/asf-site afa6a1d06 -> 7728cf94d
Remove parseMap/parseCollection references.
Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/commit/7728cf94
Tree: http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/tree/7728cf94
Diff: http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/diff/7728cf94
Branch: refs/heads/asf-site
Commit: 7728cf94df30231dbf43aac9f0faa5463f4010cb
Parents: afa6a1d
Author: JamesBognar <ja...@apache.org>
Authored: Tue Feb 7 20:21:19 2017 -0500
Committer: JamesBognar <ja...@apache.org>
Committed: Tue Feb 7 20:21:19 2017 -0500
----------------------------------------------------------------------
content/about.html | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-juneau-website/blob/7728cf94/content/about.html
----------------------------------------------------------------------
diff --git a/content/about.html b/content/about.html
index bfcfaf9..3ebf344 100644
--- a/content/about.html
+++ b/content/about.html
@@ -128,23 +128,27 @@
<jc>// Parse a JSON object as a HashMap<String,Person>.</jc>
json = <js>"{a:{name:'John Smith',age:21},b:{name:'Joe Smith',age:42}}"</js>;
- Map<String,Person> m5 = parser.parseMap(json, HashMap.<jk>class</jk>, String.<jk>class</jk>, Person.<jk>class</jk>)
+ Map<String,Person> m5 = parser.parse(json, HashMap.<jk>class</jk>, String.<jk>class</jk>, Person.<jk>class</jk>)
+ <jc>// Parse a JSON object as a HashMap<String,LinkedList<Person>>.</jc>
+ json = <js>"{a:[{name:'John Smith',age:21},{name:'Joe Smith',age:42}]}"</js>;
+ Map<String,List<Person>> m6 = parser.parse(json, HashMap.<jk>class</jk>, String.<jk>class</jk>, LinkedList.<jk>class</jk>, Person.<jk>class</jk>)
+
<jc>// Parse a JSON array of integers as a Collection of Integers or int[] array.</jc>
json = <js>"[1,2,3]"</js>;
- List<Integer> l6 = parser.parseCollection(json, LinkedList.<jk>class</jk>, Integer.<jk>class</jk>);
- <jk>int</jk>[] i6 = parser.parse(json, <jk>int</jk>[].<jk>class</jk>);
+ List<Integer> l7 = parser.parse(json, LinkedList.<jk>class</jk>, Integer.<jk>class</jk>);
+ <jk>int</jk>[] i7 = parser.parse(json, <jk>int</jk>[].<jk>class</jk>);
<jc>// Parse arbitrary input into ObjectMap or ObjectList objects (similar to JSONObject/JSONArray but generalized for all languages).</jc>
json = <js>"{name:'John Smith',age:21}"</js>;
- ObjectMap m7a = parser.parse(json, ObjectMap.<jk>class</jk>);
- <jk>int</jk> age = m7a.getInt(<js>"age"</js>);
- ObjectMap m7b = (ObjectMap)parser.parse(json, Object.<jk>class</jk>); <jc>// Equivalent.</jc>
+ ObjectMap m8a = parser.parse(json, ObjectMap.<jk>class</jk>);
+ <jk>int</jk> age = m8a.getInt(<js>"age"</js>);
+ ObjectMap m8b = (ObjectMap)parser.parse(json, Object.<jk>class</jk>); <jc>// Equivalent.</jc>
json = <js>"[1,true,null]"</js>;
- ObjectList l8a = parser.parse(json, ObjectList.<jk>class</jk>);
- <jk>boolean</jk> b = l8a.getBoolean(1);
- ObjectList l8b = (ObjectList)parser.parse(json, Object.<jk>class</jk>); <jc>// Equivalent.</jc>
+ ObjectList l9a = parser.parse(json, ObjectList.<jk>class</jk>);
+ <jk>boolean</jk> b = l9a.getBoolean(1);
+ ObjectList l9b = (ObjectList)parser.parse(json, Object.<jk>class</jk>); <jc>// Equivalent.</jc>
</p>
<p>
Many POJOs such as primitives, beans, collections, arrays, and classes with various known constructors and methods are serializable out-of-the-box.