geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r699197 - /geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/Arguments.java
Date Fri, 26 Sep 2008 07:09:39 GMT
Author: jdillon
Date: Fri Sep 26 00:09:39 2008
New Revision: 699197

URL: http://svn.apache.org/viewvc?rev=699197&view=rev
Log:
Added asQuotedString()

Modified:
    geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/Arguments.java

Modified: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/Arguments.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/Arguments.java?rev=699197&r1=699196&r2=699197&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/Arguments.java
(original)
+++ geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/Arguments.java
Fri Sep 26 00:09:39 2008
@@ -48,7 +48,7 @@
     public static String asString(final Object[] args) {
         assert args != null;
 
-        StringBuffer buff = new StringBuffer();
+        StringBuilder buff = new StringBuilder();
 
         for (int i=0; i<args.length; i++ ) {
             buff.append(args[i]);
@@ -63,7 +63,7 @@
     public static String asString(final List args) {
         assert args != null;
 
-        StringBuffer buff = new StringBuffer();
+        StringBuilder buff = new StringBuilder();
 
         for (int i=0; i<args.size(); i++ ) {
             buff.append(args.get(i));
@@ -86,4 +86,22 @@
 
         return strings;
     }
+
+    public static String asQuotedString(final Object[] args, final String quoteToken) {
+        assert args != null;
+        assert quoteToken != null;
+
+        StringBuilder buff = new StringBuilder();
+
+        for (int i=0; i<args.length; i++) {
+            buff.append(quoteToken);
+            buff.append(args[i]);
+            buff.append(quoteToken);
+            if (i+1 < args.length) {
+                buff.append(" ");
+            }
+        }
+
+        return buff.toString();
+    }
 }



Mime
View raw message