|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.jabb.util.text.CollectionFormatter
public class CollectionFormatter
Handles the formatting of collections.
| Constructor Summary | |
|---|---|
CollectionFormatter()
|
|
| Method Summary | |
|---|---|
static String |
format(Collection<?> collection)
Format a collection's elements to ',' separated string with trimming on the elements' toString(). |
static String |
format(Collection<?> collection,
boolean trim)
Format a collection's elements to ',' separated string. |
static String |
format(Collection<?> collection,
String property)
Format a collection's elements' properties to ',' separated string, with trimming on the elements' properties |
static String |
format(Collection<?> collection,
String property,
boolean trim)
Format a collection's elements' properties to ',' separated string, with trimming on the elements' properties |
static String |
format(Collection<?> collection,
String property,
String separator)
Format a collection's elements' properties to delimiter separated string, with trimming on the elements' properties |
static String |
format(Collection<?> collection,
String property,
String separator,
boolean trim)
Format a collection's elements' properties to delimiter separated string. Usage examples:
CollectionFormatter.format(myCollection, null, ",");
CollectionFormatter.format(myCollection, "personInCharge.name.firstName", ", ");
CollectionFormatter.format(myCollection, "relatedPeople(InCharge).name", ", ");
CollectionFormatter.format(myCollection, "subordinate[3].address(home).city", " | ");
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CollectionFormatter()
| Method Detail |
|---|
public static String format(Collection<?> collection,
String property,
String separator,
boolean trim)
CollectionFormatter.format(myCollection, null, ",");
CollectionFormatter.format(myCollection, "personInCharge.name.firstName", ", ");
CollectionFormatter.format(myCollection, "relatedPeople(InCharge).name", ", ");
CollectionFormatter.format(myCollection, "subordinate[3].address(home).city", " | ");
collection - The collection that will be formattedproperty - The property of the collection's element that will be put into the result string.
Please see PropertyUtils.getProperty() of commons-beanutils for detail.
Use null if the element itself needs to be put into the result string.separator - Used in the result string to separate each element.trim - true if the property need to be trimmed, false if not.
public static String format(Collection<?> collection,
String property,
String separator)
collection - The collection that will be formattedproperty - The property of the collection's element that will be put into the result string.
Please see PropertyUtils.getProperty() of commons-beanutils for detail.separator - Used in the result string to separate each element.
public static String format(Collection<?> collection)
collection - The collection that will be formatted
public static String format(Collection<?> collection,
boolean trim)
collection - The collection that will be formattedtrim - true if the elements' toString() need to be trimmed, false if not.
public static String format(Collection<?> collection,
String property)
collection - The collection that will be formattedproperty - The property of the collection's element that will be put into the result string.
Please see PropertyUtils.getProperty() of commons-beanutils for detail.
public static String format(Collection<?> collection,
String property,
boolean trim)
collection - The collection that will be formattedproperty - The property of the collection's element that will be put into the result string.
Please see PropertyUtils.getProperty() of commons-beanutils for detail.trim - true if the elements' toString() need to be trimmed, false if not.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||