|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object olg.csv.bean.getter.AbstractGetter
public abstract class AbstractGetter
This class extracts a string from a row. In the bean reading process from a Strings List, this class is used to extract a string identified as property of the bean to produce.
Field Summary | |
---|---|
private String |
defaultValue
This value is apply when this getter cannot extract String from a row. |
private AbstractStringFilter |
filter
An optional filter. |
Constructor Summary | |
---|---|
AbstractGetter()
|
Method Summary | |
---|---|
protected abstract String |
doGet(Row line)
Returns a String built from the given row. |
String |
get(Row line)
Returns a String from a row. if a filter is defined, the string returned by doGet method is filtered.If this String is empty or null, the default value is returned. |
static AbstractGetter |
getConcate(List<AbstractGetter> getters,
String defaultValue)
Returns a new instance of a concate Getter. |
static AbstractGetter |
getConstant(String defaultValue)
Returns a new instance of a constant Getter. |
static AbstractGetter |
getDefault(String rang,
String defaultValue)
Returns a new instance of the default getter. |
String |
getDefaultValue()
In case of this getter cannot extract a string from list, it's possible to apply a default value in replacement of. |
AbstractStringFilter |
getFilter()
Returns the filter used to filter the String returned by doGet(Row) . |
void |
setDefaultValue(String defaultValue)
Sets the given value as default value. |
void |
setFilter(AbstractStringFilter filter)
Sets the given filter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private String defaultValue
null
as default value.
private AbstractStringFilter filter
null
as default value.
Constructor Detail |
---|
public AbstractGetter()
Method Detail |
---|
public final String getDefaultValue()
doGet(Row)
public final void setDefaultValue(String defaultValue)
defaultValue
- the default value to use when the filtered "getted" string is
null
or empty.doGet(Row)
public final AbstractStringFilter getFilter()
doGet(Row)
.
public final void setFilter(AbstractStringFilter filter)
filter
- the fitler.protected abstract String doGet(Row line)
line
- the row from which extract the string.
public final String get(Row line)
throws an IllegalArgumentException When Error occurs if the given line is
null
.
line
- the row.
public static final AbstractGetter getDefault(String rang, String defaultValue)
rang
- the cell number in the row. Must be greater or equals than 0
or conformed to the sheet cell number format.defaultValue
- default value to apply if the filtered String at the given
rank is null
or empty.
public static final AbstractGetter getConcate(List<AbstractGetter> getters, String defaultValue)
getters
- List of AbstractGetters which product a String from a Row.
Must not be null
or empty.defaultValue
- default value to apply if the filtered string from concate is
null
or empty.
public static final AbstractGetter getConstant(String defaultValue)
defaultValue
- the value the getter returns
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |