Package net.sf.basedb.util.formatter
Class ToStringFormatter<T>
- java.lang.Object
-
- net.sf.basedb.util.formatter.ToStringFormatter<T>
-
- All Implemented Interfaces:
ExcelFormatter<T,String>
,Formatter<T>
public class ToStringFormatter<T> extends Object implements Formatter<T>, ExcelFormatter<T,String>
A generic formatter that simply formats objects by calling the toString() method. Null values are converted to the empty string.- Version:
- 2.0
- Author:
- nicklas
- Last modified
- $Date: 2019-03-14 09:31:57 +0100 (tors, 14 mars 2019) $
-
-
Constructor Summary
Constructors Constructor Description ToStringFormatter()
Create a new integer formatter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
format(T value)
Format a value by converting it to a string.T
parseString(String value)
Parse a string and return a value of the correct type.ExcelValue<String>
toExcelValue(T value)
Convert and format the given value to an Excel value.
-
-
-
Method Detail
-
format
public String format(T value)
Description copied from interface:Formatter
Format a value by converting it to a string.
-
parseString
public T 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<T>
- Parameters:
value
- The string to parse- Returns:
- An object
-
toExcelValue
public ExcelValue<String> toExcelValue(T value)
Description copied from interface:ExcelFormatter
Convert and format the given value to an Excel value. If the value is null the implementation may return null to create an empty cell or it may return another non-null value.- Specified by:
toExcelValue
in interfaceExcelFormatter<T,String>
- Since:
- 3.15
-
-