Package net.sf.basedb.util.formatter
Class IntegerFormatter
java.lang.Object
net.sf.basedb.util.formatter.IntegerFormatter
- All Implemented Interfaces:
ExcelFormatter<Number,
,Number> Formatter<Number>
public class IntegerFormatter
extends Object
implements Formatter<Number>, ExcelFormatter<Number,Number>
Formats a number as an integer.
- Version:
- 2.2
- Author:
- nicklas
- Last modified
- $Date: 2023-04-20 09:47:14 +0200 (Thu, 20 Apr 2023) $
-
Field Summary
-
Constructor Summary
ConstructorDescriptionIntegerFormatter
(boolean longValues) Create a new integer formatter.IntegerFormatter
(boolean longValues, Character thousandsSeparator) Create a new integer formatter with a thousands separator. -
Method Summary
Modifier and TypeMethodDescriptionFormat a value by converting it to a string.parseString
(String value) Parse a string and return a value of the correct type.toExcelValue
(Number value) Convert and format the given value to an Excel value.
-
Field Details
-
longValues
private final boolean longValues -
format
-
-
Constructor Details
-
IntegerFormatter
public IntegerFormatter(boolean longValues) Create a new integer formatter.- Parameters:
longValues
- If theparseString(String)
method should return long or int values
-
IntegerFormatter
Create a new integer formatter with a thousands separator.- Parameters:
longValues
- If theparseString(String)
method should return long or int values- Since:
- 3.19.8
-
-
Method Details
-
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<Number>
- 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<Number,
Number> - Since:
- 3.15
-