public class CompoundMapper extends java.lang.Object implements Mapper
Modifier and Type | Field and Description |
---|---|
private java.util.List<Mapper> |
mappers |
private boolean |
nullIfException |
private java.text.NumberFormat |
parser |
Constructor and Description |
---|
CompoundMapper(java.util.List<Mapper> mappers)
Create a new compound mapper.
|
CompoundMapper(java.util.List<Mapper> mappers,
java.text.NumberFormat parser,
boolean nullIfException)
Create a new compound mapper, using a specific number formatter as it's parser.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Float |
getFloat(FlatFileParser.Data data)
Get the value for the line of data as a float.
|
java.lang.Integer |
getInt(FlatFileParser.Data data)
Get the value for the line of data as an integer.
|
java.lang.String |
getValue(FlatFileParser.Data data)
Get a value by invoking each mapper in the order they appear in
the list and concatenating the result.
|
java.lang.String |
toString() |
private final java.util.List<Mapper> mappers
private final java.text.NumberFormat parser
private final boolean nullIfException
public CompoundMapper(java.util.List<Mapper> mappers)
mappers
- A list of other mappers that will be invoked in
the order they appear in the listpublic CompoundMapper(java.util.List<Mapper> mappers, java.text.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 java.lang.String getValue(FlatFileParser.Data data)
public java.lang.Integer getInt(FlatFileParser.Data data)
Mapper
public java.lang.Float getFloat(FlatFileParser.Data data)
Mapper
public java.lang.String toString()
toString
in class java.lang.Object