Package net.sf.basedb.util.parser
Class CompoundMapper
java.lang.Object
net.sf.basedb.util.parser.CompoundMapper
- All Implemented Interfaces:
Mapper
A compound mapper that gets its value by invoking multiple other mappers
which are set in the constructor. This type of mapper is used to combine
constant strings with column values.
- Version:
- 2.0
- Author:
- nicklas
- Last modified
- $Date: 2019-04-11 09:31:26 +0200 (tors, 11 apr. 2019) $
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCompoundMapper
(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.CompoundMapper
(List<Mapper> mappers, NumberFormat parser, Formatter<Date> dateParser, boolean nullIfException) Create a new compound mapper, using a specific number formatter as it's parser. -
Method Summary
Modifier and TypeMethodDescriptiongetDate
(FlatFileParser.Data data) Get the value for the line of data as a date.getDouble
(FlatFileParser.Data data) Get the value for the line of data as a double.getFloat
(FlatFileParser.Data data) Get the value for the line of data as a float.getInt
(FlatFileParser.Data data) Get the value for the line of data as an integer.getLong
(FlatFileParser.Data data) Get the value for the line of data as a long.getString
(FlatFileParser.Data data) Get a value by invoking each mapper in the order they appear in the list and concatenating the result.getValue
(FlatFileParser.Data data) Deprecated.toString()
-
Field Details
-
mappers
-
parser
-
dateParser
-
nullIfException
private final boolean nullIfException
-
-
Constructor Details
-
CompoundMapper
Create a new compound mapper.- Parameters:
mappers
- A list of other mappers that will be invoked in the order they appear in the list
-
CompoundMapper
Create a new compound mapper, using a specific number formatter as it's parser.- Parameters:
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 thrown- Since:
- 2.4
-
CompoundMapper
public CompoundMapper(List<Mapper> mappers, NumberFormat parser, Formatter<Date> dateParser, boolean nullIfException) Create a new compound mapper, using a specific number formatter as it's parser.- Parameters:
mappers
- A list of other mappers that will be invoked in the order they appear in the listparser
- The date format to usenullIfException
- If TRUE, the mapper returns null for unparsable numeric values, otherwise an excption is thrown- Since:
- 3.15
-
-
Method Details
-
getValue
Deprecated.Description copied from interface:Mapper
Get the value for the line of data. -
getString
Get a value by invoking each mapper in the order they appear in the list and concatenating the result. -
getInt
Description copied from interface:Mapper
Get the value for the line of data as an integer. -
getLong
Description copied from interface:Mapper
Get the value for the line of data as a long. -
getFloat
Description copied from interface:Mapper
Get the value for the line of data as a float. -
getDouble
Description copied from interface:Mapper
Get the value for the line of data as a double. -
getDate
Description copied from interface:Mapper
Get the value for the line of data as a date. -
toString
-