Package net.sf.basedb.util.formatter
Class BooleanFormatter
java.lang.Object
net.sf.basedb.util.formatter.BooleanFormatter
- All Implemented Interfaces:
ExcelFormatter<Boolean,
,Object> Formatter<Boolean>
public class BooleanFormatter
extends Object
implements Formatter<Boolean>, ExcelFormatter<Boolean,Object>
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: 2024-10-30 13:32:46 +0100 (Wed, 30 Oct 2024) $
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enum for holding the various types of boolean output. -
Field Summary
-
Constructor Summary
ConstructorDescriptionCreate a new boolean formatter. -
Method Summary
Modifier and TypeMethodDescriptionFormat a value by converting it to a string.static BooleanFormatter
Create a formatter for boolean values.parseString
(String value) Parse a string and return a value of the correct type.toExcelValue
(Boolean value) Convert and format the given value to an Excel value.
-
Field Details
-
type
-
-
Constructor Details
-
BooleanFormatter
Create a new boolean formatter.- Parameters:
type
- The type of output
-
-
Method Details
-
fromType
Create a formatter for boolean values.- Returns:
- A formatter or null if there is no type
- Since:
- 3.19.12
-
format
Description copied from interface:Formatter
Format a value by converting it to a string. -
parseString
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
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,
Object> - Since:
- 3.15
-