Package net.sf.basedb.util.parser
Class CropStringMapper
- java.lang.Object
-
- net.sf.basedb.util.parser.CropStringMapper
-
- All Implemented Interfaces:
Mapper
public class CropStringMapper extends Object implements Mapper
A mapper that crops a string if it is longer than a specified length. The actual mapping is delegated to a parent mapper.- Version:
- 2.0
- Author:
- nicklas
- Last modified
- $Date: 2019-03-21 12:50:52 +0100 (tors, 21 mars 2019) $
-
-
Constructor Summary
Constructors Constructor Description CropStringMapper(Mapper parent, int maxLength)
Create a new CropStringMapper.
-
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)
Use the parent mapper to get the string value.String
getValue(FlatFileParser.Data data)
Deprecated.
-
-
-
Field Detail
-
parent
private final Mapper parent
-
maxLength
private final int maxLength
-
-
Constructor Detail
-
CropStringMapper
public CropStringMapper(Mapper parent, int maxLength)
Create a new CropStringMapper.- Parameters:
parent
- The parent mapper that does the actual mappingmaxLength
- The maximum length of stings
-
-
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)
Use the parent mapper to get the string value. Then check the length against the maximum length and crop if neccessary.
-
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.
-
-