You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2012/10/06 00:41:26 UTC

svn commit: r1394848 - in /pivot/branches/2.0.x: ./ build.properties core/src/org/apache/pivot/json/JSON.java

Author: rwhitcomb
Date: Fri Oct  5 22:41:26 2012
New Revision: 1394848

URL: http://svn.apache.org/viewvc?rev=1394848&view=rev
Log:
PIVOT-875: Allow JSON.get/put to utilize pivot.collections.Map object
directly if supplied as the data object.  Currently such a perfect
object (since every data object is coerced into one of these) would
end up using BeanAdapter instead, which means key values of "class",
"count", "comparator" and "capacity" would end up fetching the values
from the Map object itself instead of the Map data.

This is a merge of revision 1394847 from trunk to branches/2.0.x

Modified:
    pivot/branches/2.0.x/   (props changed)
    pivot/branches/2.0.x/build.properties
    pivot/branches/2.0.x/core/src/org/apache/pivot/json/JSON.java

Propchange: pivot/branches/2.0.x/
------------------------------------------------------------------------------
  Merged /pivot/trunk:r1394847

Modified: pivot/branches/2.0.x/build.properties
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/build.properties?rev=1394848&r1=1394847&r2=1394848&view=diff
==============================================================================
--- pivot/branches/2.0.x/build.properties (original)
+++ pivot/branches/2.0.x/build.properties Fri Oct  5 22:41:26 2012
@@ -27,7 +27,7 @@ compiler.source=1.6
 compiler.target=1.6
 compiler.encoding=UTF-8
 compiler.indexJars=true
-compiler.arg=-Xlint
+compiler.arg=-Xlint -bootclasspath c:/jdk1.6.0_16/jre/lib/rt.jar
 
 # Test properties
 test.verbose=false

Modified: pivot/branches/2.0.x/core/src/org/apache/pivot/json/JSON.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/core/src/org/apache/pivot/json/JSON.java?rev=1394848&r1=1394847&r2=1394848&view=diff
==============================================================================
--- pivot/branches/2.0.x/core/src/org/apache/pivot/json/JSON.java (original)
+++ pivot/branches/2.0.x/core/src/org/apache/pivot/json/JSON.java Fri Oct  5 22:41:26 2012
@@ -73,7 +73,8 @@ public class JSON {
 
             String key = keys.get(i);
 
-            Map<String, T> adapter = (Map<String, T>) (value instanceof java.util.Map ? new MapAdapter<String, T>((java.util.Map<String, T>) value) : new BeanAdapter(value));
+            Map<String, T> adapter = (Map<String, T>) (value instanceof java.util.Map ? new MapAdapter<String, T>((java.util.Map<String, T>) value) :
+                    (value instanceof org.apache.pivot.collections.Map ? ((org.apache.pivot.collections.Map<String, T>) value): new BeanAdapter(value)));
             if (adapter.containsKey(key)) {
                 value = adapter.get(key);
             } else if (value instanceof Sequence<?>) {
@@ -147,7 +148,8 @@ public class JSON {
             throw new IllegalArgumentException("Invalid path.");
         }
 
-        Map<String, T> adapter = (Map<String, T>) (parent instanceof java.util.Map ? new MapAdapter<String, T>((java.util.Map<String, T>) parent) : new BeanAdapter(parent));
+        Map<String, T> adapter = (Map<String, T>) (parent instanceof java.util.Map ? new MapAdapter<String, T>((java.util.Map<String, T>) parent) :
+                (parent instanceof org.apache.pivot.collections.Map ? ((org.apache.pivot.collections.Map<String, T>) parent): new BeanAdapter(parent)));
 
         Object previousValue;
         if (adapter.containsKey(key)) {
@@ -232,7 +234,8 @@ public class JSON {
         if (parent == null) {
             containsKey = false;
         } else {
-            Map<String, T> adapter = (Map<String, T>) (parent instanceof java.util.Map ? new MapAdapter<String, T>((java.util.Map<String, T>) parent) : new BeanAdapter(parent));
+            Map<String, T> adapter = (Map<String, T>) (parent instanceof java.util.Map ? new MapAdapter<String, T>((java.util.Map<String, T>) parent) :
+                    (parent instanceof org.apache.pivot.collections.Map ? ((org.apache.pivot.collections.Map<String, T>) parent): new BeanAdapter(parent)));
             containsKey = adapter.containsKey(key);
 
             if (!containsKey) {