|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.util.parser.ConstantMapper
public class ConstantMapper
A constant string mapper. The getValue()
always
return the same string which is set in the contructor.
Field Summary | |
---|---|
private Float |
asFloat
|
private Integer |
asInteger
|
private String |
constant
|
private boolean |
needToParseNumeric
|
private boolean |
nullIfException
|
private NumberFormatException |
parseException
|
private NumberFormat |
parser
|
Constructor Summary | |
---|---|
ConstantMapper(Float constant)
|
|
ConstantMapper(Integer constant)
|
|
ConstantMapper(String constant)
Create a constant mapper. |
|
ConstantMapper(String constant,
NumberFormat parser)
Deprecated. Use ConstantMapper(String, NumberFormat, boolean) |
|
ConstantMapper(String constant,
NumberFormat parser,
boolean nullIfException)
Create a constant mapper using a specific number formatter as it's parser. |
Method Summary | |
---|---|
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()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final String constant
private final NumberFormat parser
private final boolean nullIfException
private boolean needToParseNumeric
private Float asFloat
private Integer asInteger
private NumberFormatException parseException
Constructor Detail |
---|
public ConstantMapper(String constant)
constant
- The constant expression.public ConstantMapper(String constant, NumberFormat parser)
ConstantMapper(String, NumberFormat, boolean)
constant
- The constant expressionparser
- The number format to use or null to use Double.valueOf()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)
Method Detail |
---|
public String getValue(FlatFileParser.Data data)
Mapper
getValue
in interface Mapper
data
- The line of data
public Integer getInt(FlatFileParser.Data data)
Mapper
getInt
in interface Mapper
data
- The line of data
public Float getFloat(FlatFileParser.Data data)
Mapper
getFloat
in interface Mapper
data
- The line of data
public String toString()
toString
in class Object
private void parseNumeric()
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |