Class Filter<T extends DataObject>
- Type Parameters:
T
- the type of data objects maintained by an implementation of this filter.
- Direct Known Subclasses:
CatchAllFilter
public abstract class Filter<T extends DataObject> extends Object
A Spiderwiz filter is an object that lets you traverse the data object tree, or a branch of it, to collect data
objects of a specific type that meet a specific condition. You apply the filter by calling
DataObject.getFilteredChildren()
on the parent
of the branch you want to filter. If you want to apply the filter on the entire data object tree, call it on its
Root Object
.
Filtering works as follows. First, the object being filtered is checked for the existence of direct children of the specified type.
If there are any, filterObject()
is applied on them and the children that
returns true
are collected. If the filtered object does not have direct children of the specified type,
filterParent()
is applied on every child of the filtered object, regardless of
its type, and if the method returns true
then the filtering mechanism is applied on the child recursively.
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description protected abstract boolean
filterObject(T object)
Implement this method to returntrue
if the filtered object passes the filter.protected boolean
filterParent(DataObject parent)
Implement this method to returntrue
if filtering shall be applied on the branch under this object.
-
Constructor Details
-
Filter
Constructs a filter for a specific data object type.- Type Parameters:
T
- the type of data objects this filter applies to.- Parameters:
type
- the filter applies to objects that are instances of this class.- Throws:
NoSuchFieldException
- if class type does not contain a static field of name ObjectCode.IllegalAccessException
- if ObjectCode field is not public.
-
-
Method Details
-
filterObject
Implement this method to returntrue
if the filtered object passes the filter.- Parameters:
object
- the filtered object.- Returns:
- true if and only if the filtered object passes the filter.
-
filterParent
Implement this method to returntrue
if filtering shall be applied on the branch under this object.- Parameters:
parent
- the parent of the filtered branch.- Returns:
- true if and only if filtering shall be applied on the branch under this object.
-