You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by js...@apache.org on 2007/04/30 16:34:33 UTC
svn commit: r533760 -
/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
Author: jstrachan
Date: Mon Apr 30 07:34:32 2007
New Revision: 533760
URL: http://svn.apache.org/viewvc?view=rev&rev=533760
Log:
added a helper class for dumping array objects nicely as Strings
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java?view=diff&rev=533760&r1=533759&r2=533760
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java Mon Apr 30 07:34:32 2007
@@ -98,7 +98,7 @@
* Removes any starting characters on the given text which match the given character
*
* @param text the string
- * @param ch the initial characters to remove
+ * @param ch the initial characters to remove
* @return either the original string or the new substring
*/
public static String removeStartingCharacters(String text, char ch) {
@@ -112,8 +112,6 @@
return text;
}
-
-
/**
* Returns true if the collection contains the specified value
*/
@@ -133,7 +131,6 @@
}
}
-
/**
* Returns the predicate matching boolean on a {@link List} result set
* where if the first element is a boolean its value is used
@@ -270,5 +267,30 @@
}
while (type != null);
return answer;
+ }
+
+ /**
+ * Turns the given object arrays into a meaningful string
+ *
+ * @param objects an array of objects or null
+ * @return a meaningful string
+ */
+ public static String asString(Object[] objects) {
+ if (objects == null) {
+ return "null";
+ }
+ else {
+ StringBuffer buffer = new StringBuffer("{");
+ int counter = 0;
+ for (Object object : objects) {
+ if (counter++ > 0) {
+ buffer.append(", ");
+ }
+ String text = (object == null) ? "null" : object.toString();
+ buffer.append(text);
+ }
+ buffer.append("}");
+ return buffer.toString();
+ }
}
}