public class CompoundMapper extends Object implements Mapper
Modifier and Type | Field and Description |
---|---|
private List<Mapper> |
mappers |
private boolean |
nullIfException |
private NumberFormat |
parser |
Constructor and Description |
---|
CompoundMapper(List<Mapper> mappers)
Create a new compound mapper.
|
CompoundMapper(List<Mapper> mappers,
NumberFormat parser,
boolean nullIfException)
Create a new compound 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 a value by invoking each mapper in the order they appear in
the list and concatenating the result.
|
String |
toString() |
private final NumberFormat parser
private final boolean nullIfException
public CompoundMapper(List<Mapper> mappers)
mappers
- A list of other mappers that will be invoked in
the order they appear in the listpublic CompoundMapper(List<Mapper> mappers, NumberFormat parser, boolean nullIfException)
mappers
- A list of other mappers that will be invoked in
the order they appear in the listparser
- The number format to use or null to use Float.valueOf()nullIfException
- If TRUE, the mapper returns null for unparsable numeric
values, otherwise an excption is thrownpublic String getValue(FlatFileParser.Data data)
public Integer getInt(FlatFileParser.Data data)
Mapper
public Float getFloat(FlatFileParser.Data data)
Mapper