T
- The type to be handle by the type handler.public abstract class BaseTypeHandler<T> extends Object implements TypeHandler<T>
Constructor and Description |
---|
BaseTypeHandler() |
Modifier and Type | Method and Description |
---|---|
protected abstract String |
format(T data,
String format,
int size)
Shall format the data, regardless of filling as the filler will be added
after by the BaseTypeHandler.
|
String |
format(T data,
String format,
String filler,
int size)
Must convert the target object to its string representation
to be used on the file.
|
protected abstract T |
parse(String dados,
String format)
Shall parse the data from the string, according to format if any, and
return the resulting data.
|
T |
parse(String dados,
String format,
String filler)
Parses a given string and generate the target object from it.
|
public String format(T data, String format, String filler, int size) throws MalformedOutputException
TypeHandler
format
in interface TypeHandler<T>
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 T parse(String dados, String format, String filler) throws MalformedInputException
TypeHandler
parse
in interface TypeHandler<T>
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.protected abstract String format(T data, String format, int size)
Shall format the data, regardless of filling as the filler will be added after by the BaseTypeHandler.
data
- The data to be formated.format
- The format to be used, if any.size
- The max size the resulting string should occupy.Copyright © 2014. All Rights Reserved.