|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.jrefinery.report.filter.FormatParser
A format parser tries to parse a string into an object. If the value returned by the datasource is no string, a string is formed using String.valueOf (Object). This string is fed into the java.text.Format of this FormatParser and the parsed object is returned.
What class of object is returned, is determined by the given format. If parsing failed, the defined NullValue is returned.
Constructor Summary | |
FormatParser()
DefaultConstructor. |
Method Summary | |
java.lang.Object |
clone()
Clones the parser. |
DataSource |
getDataSource()
Returns the data source for the filter. |
java.text.Format |
getFormatter()
Returns the format for the filter. |
java.lang.Object |
getNullValue()
Returns the object representing a null value from the data source. |
java.lang.Object |
getValue()
Returns the parsed object. |
protected boolean |
isValidOutput(java.lang.Object o)
Checks whether the given value is already a valid result. |
void |
setDataSource(DataSource ds)
Sets the data source. |
void |
setFormatter(java.text.Format format)
Sets the format for the filter. |
void |
setNullValue(java.lang.Object nullvalue)
Sets the value that will be displayed if the data source supplies a null value. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public FormatParser()
Method Detail |
public void setFormatter(java.text.Format format)
format
- The format.
java.lang.NullPointerException
- if the given format is nullpublic java.text.Format getFormatter()
public java.lang.Object getValue()
If the given datasource does not return a string, the returned object is transformed into a string using String.valueOf (Object) and then parsed.
If format, datasource or object are null, the NullValue is returned.
getValue
in interface DataSource
protected boolean isValidOutput(java.lang.Object o)
o
- the object to parse.
public DataSource getDataSource()
getDataSource
in interface DataTarget
public void setDataSource(DataSource ds)
setDataSource
in interface DataTarget
ds
- The data source.public void setNullValue(java.lang.Object nullvalue)
nullvalue
- The value returned when the parsing failed.public java.lang.Object getNullValue()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in interface DataSource
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- this should never happen.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |