activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1134350 - /activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/IntrospectionSupport.java
Date Fri, 10 Jun 2011 15:37:21 GMT
Author: tabish
Date: Fri Jun 10 15:37:20 2011
New Revision: 1134350

URL: http://svn.apache.org/viewvc?rev=1134350&view=rev
Log:
Adds a toString version that allows the multiline output logic to be disable if desired.

Modified:
    activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/IntrospectionSupport.java

Modified: activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/IntrospectionSupport.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/IntrospectionSupport.java?rev=1134350&r1=1134349&r2=1134350&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/IntrospectionSupport.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/IntrospectionSupport.java
Fri Jun 10 15:37:20 2011
@@ -254,22 +254,26 @@ public final class IntrospectionSupport 
     }
 
     public static String toString(Object target) {
-        return toString(target, Object.class, null, (String[])null);
+        return toString(target, Object.class, true, null, (String[])null);
     }
-    
+
     public static String toString(Object target, String...fields) {
-        return toString(target, Object.class, null, fields);
+        return toString(target, Object.class, true, null, fields);
     }
-    
+
     public static String toString(Object target, Class<?> stopClass) {
-    	return toString(target, stopClass, null, (String[])null);
+    	return toString(target, stopClass, true, null, (String[])null);
     }
 
     public static String toString(Object target, Map<String, Object> overrideFields,
String...fields) {
-        return toString(target, Object.class, overrideFields, fields);
+        return toString(target, Object.class, true, overrideFields, fields);
     }
 
     public static String toString(Object target, Class<?> stopClass, Map<String,
Object> overrideFields, String ... fields) {
+        return toString(target, stopClass, true, overrideFields, fields);
+    }
+
+    public static String toString(Object target, Class<?> stopClass, boolean allowMultiLine,
Map<String, Object> overrideFields, String ... fields) {
         try {
             LinkedHashMap<String, Object> map = new LinkedHashMap<String, Object>();
             addFields(target, target.getClass(), stopClass, map);
@@ -291,7 +295,7 @@ public final class IntrospectionSupport 
                 String value = null;
                 if( entry.getValue() !=null ) {
                     value = entry.getValue().toString();
-                    if( value!=null && ( value.indexOf('\n')>=0 || (key.length()+value.length())>70
) ) {
+                    if( allowMultiLine && value!=null && ( value.indexOf('\n')>=0
|| (key.length()+value.length())>70 ) ) {
                         useMultiLine=true;
                     }
                 }
@@ -337,7 +341,6 @@ public final class IntrospectionSupport 
         }
     }
 
-
     public static String simpleName(Class<?> clazz) {
         String name = clazz.getName();
         int p = name.lastIndexOf(".");



Mime
View raw message