com.xebialabs.deployit.util
Class ExtendedStringUtils

java.lang.Object
  extended by com.xebialabs.deployit.util.ExtendedStringUtils

public class ExtendedStringUtils
extends java.lang.Object

Utility class for some useful String manipulations.


Field Summary
static java.lang.String DEFAULT_JOIN_SEPARATOR
          The default join separator used by join(Collection, Transformer).
 
Constructor Summary
ExtendedStringUtils()
           
 
Method Summary
static java.lang.String getQuotedString(java.lang.String str)
          Returns the string wrapped between double quotes if it contains a space or if it is empty.
static
<T> java.lang.String
join(java.util.Collection<T> collection, org.apache.commons.collections.Transformer toStringGenerator)
          Joins the string representations of a collection to form one string using the default join separator.
static
<T> java.lang.String
join(java.util.Collection<T> collection, org.apache.commons.collections.Transformer toStringGenerator, java.lang.String separator)
          Joins the string representations of a collection to form one string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_JOIN_SEPARATOR

public static final java.lang.String DEFAULT_JOIN_SEPARATOR
The default join separator used by join(Collection, Transformer).

See Also:
Constant Field Values
Constructor Detail

ExtendedStringUtils

public ExtendedStringUtils()
Method Detail

getQuotedString

public static java.lang.String getQuotedString(java.lang.String str)
Returns the string wrapped between double quotes if it contains a space or if it is empty.

Parameters:
str - the string to quote
Returns:
the quoted string

join

public static <T> java.lang.String join(java.util.Collection<T> collection,
                                        org.apache.commons.collections.Transformer toStringGenerator)
Joins the string representations of a collection to form one string using the default join separator.

Type Parameters:
T - the type of the collection members.
Parameters:
collection - the collection to join.
toStringGenerator - the Transformer that transforms a collection member to its string representation.
Returns:
the joined string.

join

public static <T> java.lang.String join(java.util.Collection<T> collection,
                                        org.apache.commons.collections.Transformer toStringGenerator,
                                        java.lang.String separator)
Joins the string representations of a collection to form one string.

Type Parameters:
T - the type of the collection members.
Parameters:
collection - the collection to join.
toStringGenerator - the Transformer that transforms a collection member to its string representation.
separator - the string that will separate the strings when they are joined together.
Returns:
the joined string.


Copyright © 2010. All Rights Reserved.