public abstract class NumberTypeHandler extends Object implements TypeHandler<Number>
Modifier and Type | Field and Description |
---|---|
protected DecimalFormat |
decimalFormat |
Constructor and Description |
---|
NumberTypeHandler() |
Modifier and Type | Method and Description |
---|---|
String |
format(Number data,
String format,
String filler,
int size)
Must convert the target object to its string representation
to be used on the file.
|
Number |
parse(String dados,
String format,
String filler)
Parses a given string and generate the target object from it.
|
protected DecimalFormat decimalFormat
public String format(Number data, String format, String filler, int size) throws MalformedOutputException
TypeHandler
format
in interface TypeHandler<Number>
data
- The data to be converted.format
- The format to be used if any, it is the format given in the layout file.filler
- The filler configured to be used with this data.size
- The size configured to be used in the layout.MalformedOutputException
- When the data cannot be handled for some reason.public Number parse(String dados, String format, String filler) throws MalformedInputException
TypeHandler
parse
in interface TypeHandler<Number>
dados
- The data to be parsed in its string form.format
- The format configured in the layout.filler
- The filler configured and used with this data.MalformedInputException
- If there is any problem with the data.Copyright © 2014. All Rights Reserved.