CellProcessor
, StringCellProcessor
public class ParseBigDecimal extends CellProcessorAdaptor implements StringCellProcessor
BigDecimal
).
If the data uses a character other than "." as a decimal separator (Germany uses "," for example), then use the constructor that accepts a DecimalFormatSymbols object, as it will convert the character to a "." before creating the BigDecimal. Likewise if the data contains a grouping separator (Germany uses "." for example) then supplying a DecimalFormatSymbols object will allow grouping separators to be removed before parsing.
next
Constructor | Description |
---|---|
ParseBigDecimal() |
Constructs a new ParseBigDecimal processor, which converts a String to a BigDecimal.
|
ParseBigDecimal(DecimalFormatSymbols symbols) |
Constructs a new ParseBigDecimal processor, which converts a String to a BigDecimal using the supplied
DecimalFormatSymbols object to convert any decimal separator to a "." before creating the BigDecimal.
|
ParseBigDecimal(DecimalFormatSymbols symbols,
CellProcessor next) |
Constructs a new ParseBigDecimal processor, which converts a String to a BigDecimal using the supplied
DecimalFormatSymbols object to convert any decimal separator to a "." before creating the BigDecimal,
then calls the next processor in the chain.
|
ParseBigDecimal(CellProcessor next) |
Constructs a new ParseBigDecimal processor, which converts a String to a BigDecimal then calls the next
processor in the chain.
|
Modifier and Type | Method | Description |
---|---|---|
Object |
execute(Object value,
CsvContext context) |
This method is invoked by the framework when the processor needs to process data or check constraints.
|
toString, validateInputNotNull
public ParseBigDecimal()
public ParseBigDecimal(DecimalFormatSymbols symbols)
symbols
- the decimal format symbols, containing the decimal separatorNullPointerException
- if symbols is nullpublic ParseBigDecimal(CellProcessor next)
next
- the next processor in the chainNullPointerException
- if next is nullpublic ParseBigDecimal(DecimalFormatSymbols symbols, CellProcessor next)
symbols
- the decimal format symbols, containing the decimal separatornext
- the next processor in the chainNullPointerException
- if symbols or next is nullpublic Object execute(Object value, CsvContext context)
execute
in interface CellProcessor
value
- the value to be processedcontext
- the CSV contextSuperCsvCellProcessorException
- if value is null, isn't a String, or can't be parsed as a BigDecimalCopyright © 2007–2018 Super CSV. All rights reserved.