There is one base class RowFilter
(see RowFilter.java) all filters
must be derived from. It forces you to implement three functions for each new
row filter:
matches
, which returns a boolean result indicating whether or not
to include the row into the result,
saveSettings
, a method saving the filter's settings into a config
object, and
loadSettingsFrom
which should read the settings from a config
object.
In order to recreate a filter from a given config object there exists a
rowfilter factory (see RowFilterFactory
). The abstract RowFilter
adds an identifier string to the config object (before it delegates the
actual saving of the settings to the derived class) and the factory reads
this ID string (at loading time) to create the corresponding filter class.
As a consequence of this, each new filter must be registered with the
RowFilterFactory
. The wheres and hows can be easily figured
out by looking at the comments in RowFilterFactory.java and to look at the
existing examples there.
Filters must decide in the matches
method if a row should be
included (result true
) or filtered out (result false
)
from the result table. For that the entire row and the row number is passed to
this function. However, if a filter can already tell the result for the current
row and all following rows, it can throw an exception and will not be bothered
for any more rows. There is a EndOfTableException
and a
IncludeFromNowOn
exception which can be thrown to exclude/include
resp. the current and all following rows.