Package net.sf.basedb.util.formatter
Class BooleanFormatter
- java.lang.Object
-
- net.sf.basedb.util.formatter.BooleanFormatter
-
- All Implemented Interfaces:
ExcelFormatter<Boolean,Boolean>
,Formatter<Boolean>
public class BooleanFormatter extends Object implements Formatter<Boolean>, ExcelFormatter<Boolean,Boolean>
Formats a boolean value. It is possible to select between yes/no, true/false, and 1/0 mappings.- Version:
- 2.0
- Author:
- nicklas
- Last modified
- $Date: 2019-03-14 07:52:48 +0100 (tors, 14 mars 2019) $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BooleanFormatter.Type
Enum for holding the various types of boolean output.
-
Field Summary
Fields Modifier and Type Field Description private BooleanFormatter.Type
type
-
Constructor Summary
Constructors Constructor Description BooleanFormatter(BooleanFormatter.Type type)
Create a new boolean formatter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
format(Boolean value)
Format a value by converting it to a string.Boolean
parseString(String value)
Parse a string and return a value of the correct type.ExcelValue<Boolean>
toExcelValue(Boolean value)
Convert and format the given value to an Excel value.
-
-
-
Field Detail
-
type
private final BooleanFormatter.Type type
-
-
Constructor Detail
-
BooleanFormatter
public BooleanFormatter(BooleanFormatter.Type type)
Create a new boolean formatter.- Parameters:
type
- The type of output
-
-
Method Detail
-
format
public String format(Boolean value)
Description copied from interface:Formatter
Format a value by converting it to a string.
-
parseString
public Boolean 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<Boolean>
- Parameters:
value
- The string to parse- Returns:
- An object
-
toExcelValue
public ExcelValue<Boolean> toExcelValue(Boolean 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<Boolean,Boolean>
- Since:
- 3.15
-
-