Package net.sf.basedb.util.formatter
Class CollectionFormatter<I>
- java.lang.Object
-
- net.sf.basedb.util.formatter.CollectionFormatter<I>
-
- All Implemented Interfaces:
Formatter<Collection<I>>
public class CollectionFormatter<I> extends Object implements Formatter<Collection<I>>
Formatter implementation that formats a collection of values to a string by concatenating the values with a given separator. Reverse parsing is not supported.- Since:
- 3.16
- Author:
- nicklas
-
-
Constructor Summary
Constructors Constructor Description CollectionFormatter(String separator, boolean skipNull, Formatter<? super I> parent)
CollectionFormatter(Formatter<? super I> parent)
Create a collection formatting using ", " as separator and skipping null values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
format(Collection<I> values)
Format a value by converting it to a string.Collection<I>
parseString(String value)
Parse a string and return a value of the correct type.
-
-
-
Method Detail
-
format
public String format(Collection<I> values)
Description copied from interface:Formatter
Format a value by converting it to a string.
-
parseString
public Collection<I> parseString(String value)
Description copied from interface:Formatter
Parse a string and return a value of the correct type. A null input string should (unless otherwise documented by a specific formatter implementation) be allowed and may return null or any other "default" value.- Specified by:
parseString
in interfaceFormatter<I>
- Parameters:
value
- The string to parse- Returns:
- An object
-
-