Author: lindner
Date: Tue Feb 17 22:16:36 2009
New Revision: 745275

URL: http://svn.apache.org/viewvc?rev=745275&view=rev
Log:
SHINDIG-888 | Reduce json output for people requests only generate 
isOwner/isViewer output if they are true.

Modified:
    
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/JsonSerializer.java

Modified: 
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/JsonSerializer.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/JsonSerializer.java?rev=745275&r1=745274&r2=745275&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/JsonSerializer.java
 (original)
+++ 
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/JsonSerializer.java
 Tue Feb 17 22:16:36 2009
@@ -189,15 +189,20 @@
       try {
         Object value = entry.getValue().invoke(pojo);
         if (value != null) {
-          // Drop null values.
-          if (firstDone) {
-            buf.append(',');
-          } else {
-            firstDone = true;
+          String attribute = entry.getKey();
+
+          // Common use case isOwner/isViewer should not be set unless true
+          if (!((attribute.equals("isOwner") || attribute.equals("isViewer")) 
&& value.equals(Boolean.FALSE))) {
+            // Drop null values.
+            if (firstDone) {
+              buf.append(',');
+            } else {
+              firstDone = true;
+            }
+            appendString(buf, attribute);
+            buf.append(':');
+            append(buf, value);
           }
-          appendString(buf, entry.getKey());
-          buf.append(':');
-          append(buf, value);
         }
       } catch (IllegalArgumentException e) {
         // Shouldn't be possible.


Reply via email to