Package org.openbravo.erpCommon.utility
Class StringCollectionUtils
- java.lang.Object
-
- org.openbravo.erpCommon.utility.StringCollectionUtils
-
public class StringCollectionUtils extends Object
Provides common utilities to handleCollection
s asString
s.
-
-
Constructor Summary
Constructors Constructor Description StringCollectionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
commaSeparated(Object[] col)
Equivalent tocommaSeparated(Collection)
using an Array as parameter.static String
commaSeparated(Collection<?> col)
Returns aString
including all elements in theCollection
received as parameter separated by a comma and quoted with single quotes ('
).static String
commaSeparated(Collection<?> col, boolean addQuotes)
Returns aString
including all elements in theCollection
received as parameter separated by a comma.static boolean
isEmptyCollection(String collection)
Checks if a comma separated representation of a collection represents an empty collection.
-
-
-
Method Detail
-
commaSeparated
public static String commaSeparated(Collection<?> col)
Returns aString
including all elements in theCollection
received as parameter separated by a comma and quoted with single quotes ('
).- Parameters:
col
- ACollection
to be represented as comma separatedString
.- Returns:
- A
String
representation ofcol
.
-
commaSeparated
public static String commaSeparated(Object[] col)
Equivalent tocommaSeparated(Collection)
using an Array as parameter.
-
commaSeparated
public static String commaSeparated(Collection<?> col, boolean addQuotes)
Returns aString
including all elements in theCollection
received as parameter separated by a comma.- Parameters:
col
- ACollection
to be represented as comma separatedString
.addQuotes
- Should each value in theCollection
be surrounded by single quotes'
- Returns:
- A
String
representation ofcol
.
-
isEmptyCollection
public static boolean isEmptyCollection(String collection)
Checks if a comma separated representation of a collection represents an empty collection.- Parameters:
collection
- A comma separated representation of a collection- Returns:
true
if the providedString
represents an empty collection. Otherwise, returnfalse
.
-
-