Package net.sf.basedb.util.parser
Class ConstantMapper
- java.lang.Object
-
- net.sf.basedb.util.parser.ConstantMapper
-
-
Field Summary
Fields Modifier and Type Field Description private Date
asDate
private Double
asDouble
private Long
asLong
private String
constant
private Formatter<Date>
dateParser
private boolean
needToParseDate
private boolean
needToParseNumeric
private boolean
nullIfException
private RuntimeException
parseException
private NumberFormat
parser
-
Constructor Summary
Constructors Constructor 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.ConstantMapper(String constant, NumberFormat parser, Formatter<Date> dateParser, boolean nullIfException)
Create a constant mapper using a specific number formatter as it's parser.ConstantMapper(Date constant, Formatter<Date> dateParser)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Date
getDate(FlatFileParser.Data data)
Get the value for the line of data as a date.Double
getDouble(FlatFileParser.Data data)
Get the value for the line of data as a double.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.Long
getLong(FlatFileParser.Data data)
Get the value for the line of data as a long.String
getString(FlatFileParser.Data data)
Get the value for the line of data as a string.String
getValue(FlatFileParser.Data data)
Deprecated.private void
parseDate()
private void
parseNumeric()
String
toString()
-
-
-
Field Detail
-
constant
private final String constant
-
parser
private final NumberFormat parser
-
nullIfException
private final boolean nullIfException
-
needToParseNumeric
private boolean needToParseNumeric
-
needToParseDate
private boolean needToParseDate
-
asDouble
private Double asDouble
-
asLong
private Long asLong
-
asDate
private Date asDate
-
parseException
private RuntimeException parseException
-
-
Constructor Detail
-
ConstantMapper
public ConstantMapper(String constant)
Create a constant mapper.- Parameters:
constant
- The constant expression.
-
ConstantMapper
public ConstantMapper(String constant, NumberFormat parser, boolean nullIfException)
Create a constant mapper using a specific number formatter as it's parser.- Parameters:
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 thrown- Since:
- 2.4
-
ConstantMapper
public ConstantMapper(String constant, NumberFormat parser, Formatter<Date> dateParser, boolean nullIfException)
Create a constant mapper using a specific number formatter as it's parser.- Parameters:
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 thrown- Since:
- 3.15
-
ConstantMapper
public ConstantMapper(Integer constant)
-
ConstantMapper
public ConstantMapper(Float constant)
-
-
Method Detail
-
getValue
@Deprecated public String getValue(FlatFileParser.Data data)
Deprecated.Description copied from interface:Mapper
Get the value for the line of data.
-
getString
public String getString(FlatFileParser.Data data)
Description copied from interface:Mapper
Get the value for the line of data as a string.
-
getInt
public Integer getInt(FlatFileParser.Data data)
Description copied from interface:Mapper
Get the value for the line of data as an integer.
-
getLong
public Long getLong(FlatFileParser.Data data)
Description copied from interface:Mapper
Get the value for the line of data as a long.
-
getFloat
public Float getFloat(FlatFileParser.Data data)
Description copied from interface:Mapper
Get the value for the line of data as a float.
-
getDouble
public Double getDouble(FlatFileParser.Data data)
Description copied from interface:Mapper
Get the value for the line of data as a double.
-
getDate
public Date getDate(FlatFileParser.Data data)
Description copied from interface:Mapper
Get the value for the line of data as a date.
-
parseNumeric
private void parseNumeric()
-
parseDate
private void parseDate()
-
-