Modifier and Type | Field and Description |
---|---|
private Float |
asFloat |
private Integer |
asInteger |
private String |
constant |
private boolean |
needToParseNumeric |
private boolean |
nullIfException |
private NumberFormatException |
parseException |
private NumberFormat |
parser |
Constructor and Description |
---|
ConstantMapper(Float constant) |
ConstantMapper(Integer constant) |
ConstantMapper(String constant)
Create a constant mapper.
|
ConstantMapper(String constant,
NumberFormat parser,
boolean nullIfException)
Create a constant mapper using a specific number formatter as it's parser.
|
Modifier and Type | Method and Description |
---|---|
Float |
getFloat(FlatFileParser.Data data)
Get the value for the line of data as a float.
|
Integer |
getInt(FlatFileParser.Data data)
Get the value for the line of data as an integer.
|
String |
getValue(FlatFileParser.Data data)
Get the value for the line of data.
|
private void |
parseNumeric() |
String |
toString() |
private final String constant
private final NumberFormat parser
private final boolean nullIfException
private boolean needToParseNumeric
private Float asFloat
private Integer asInteger
private NumberFormatException parseException
public ConstantMapper(String constant)
constant
- The constant expression.public ConstantMapper(String constant, NumberFormat parser, boolean nullIfException)
constant
- The constant expressionparser
- The number format to use or null to use Double.valueOf()nullIfException
- If TRUE, the mapper returns null for unparsable numeric
values, otherwise an excption is thrownpublic ConstantMapper(Integer constant)
public ConstantMapper(Float constant)
public String getValue(FlatFileParser.Data data)
Mapper
public Integer getInt(FlatFileParser.Data data)
Mapper
public Float getFloat(FlatFileParser.Data data)
Mapper
private void parseNumeric()