org.supercsv.cellprocessor
Class ParseBigDecimal
- java.lang.Object
-
- org.supercsv.cellprocessor.CellProcessorAdaptor
-
- org.supercsv.cellprocessor.ParseBigDecimal
-
- All Implemented Interfaces:
- CellProcessor, StringCellProcessor
public class ParseBigDecimal extends CellProcessorAdaptor implements StringCellProcessor
Convert a String to a BigDecimal. It uses the String constructor of BigDecimal (new BigDecimal("0.1")) as it yields predictable results (seeBigDecimal).If the data uses a character other than "." as a decimal separator (France uses "," for example), then use the constructor that accepts a DecimalFormatSymbols object, as it will convert the character to a "." before creating the BigDecimal.
- Since:
- 1.30
-
-
Constructor Summary
Constructors Constructor and Description ParseBigDecimal()Constructs a new ParseBigDecimal processor, which converts a String to a BigDecimal.ParseBigDecimal(CellProcessor next)Constructs a new ParseBigDecimal processor, which converts a String to a BigDecimal then calls the next processor in the chain.ParseBigDecimal(java.text.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(java.text.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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.Objectexecute(java.lang.Object value, CsvContext context)This method is invoked by the framework when the processor needs to process data or check constraints.-
Methods inherited from class org.supercsv.cellprocessor.CellProcessorAdaptor
toString
-
-
-
-
Constructor Detail
-
ParseBigDecimal
public ParseBigDecimal()
Constructs a new ParseBigDecimal processor, which converts a String to a BigDecimal.
-
ParseBigDecimal
public ParseBigDecimal(java.text.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.- Parameters:
symbols- the decimal format symbols, containing the decimal separator- Throws:
java.lang.NullPointerException- if symbols is null
-
ParseBigDecimal
public ParseBigDecimal(CellProcessor next)
Constructs a new ParseBigDecimal processor, which converts a String to a BigDecimal then calls the next processor in the chain.- Parameters:
next- the next processor in the chain- Throws:
java.lang.NullPointerException- if next is null
-
ParseBigDecimal
public ParseBigDecimal(java.text.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.- Parameters:
symbols- the decimal format symbols, containing the decimal separatornext- the next processor in the chain- Throws:
java.lang.NullPointerException- if symbols or next is null
-
-
Method Detail
-
execute
public java.lang.Object execute(java.lang.Object value, CsvContext context)This method is invoked by the framework when the processor needs to process data or check constraints.- Specified by:
executein interfaceCellProcessor- Throws:
SuperCsvCellProcessorException- if value is null, isn't a String, or can't be parsed as a BigDecimal
-
-
DMelt 3.0 © DataMelt by jWork.ORG