wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r821211 - /incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/registry/ProvidersRegistry.java
Date Sat, 03 Oct 2009 00:58:02 GMT
Author: bluk
Date: Sat Oct  3 00:58:01 2009
New Revision: 821211

URL: http://svn.apache.org/viewvc?rev=821211&view=rev
Log:
Add better formatting for toString() MediaTypeMap

Thanks Wendy Raschke for the contribution.

See [WINK-210]

Modified:
    incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/registry/ProvidersRegistry.java

Modified: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/registry/ProvidersRegistry.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/registry/ProvidersRegistry.java?rev=821211&r1=821210&r2=821211&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/registry/ProvidersRegistry.java
(original)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/registry/ProvidersRegistry.java
Sat Oct  3 00:58:01 2009
@@ -663,7 +663,39 @@
 
         @Override
         public String toString() {
-            return String.format("RawType: %s, Data: %s", String.valueOf(rawType), data.toString());
+            return toString("  ");
+        }
+
+        protected String toString(String indent) {
+            StringBuffer sb = new StringBuffer();
+
+            sb.append("\nRawType: ");
+            sb.append(String.valueOf(rawType));
+            sb.append("\nData Map: ");
+            if (data.isEmpty()) {
+                sb.append("{empty}");
+            } else {
+                sb.append("\n");
+            }
+
+            // The data Map can be huge. Separate entries
+            // to make it more understandable
+            for (MediaType k : data.keySet()) {
+                sb.append("MediaType key = ");
+                sb.append(k);
+                sb.append("\n");
+                sb.append("ObjectFactory Set value = {\n");
+
+                // Separate each ObjectFactory entry in the Set
+                // into its own line
+                for (ObjectFactory<T> of : data.get(k)) {
+                    sb.append(indent);
+                    sb.append(of);
+                    sb.append("\n");
+                }
+                sb.append("}\n");
+            }
+            return sb.toString();
         }
 
         private class OFHolder<T> implements ObjectFactory<T>, Comparable<OFHolder<T>>
{



Mime
View raw message