Package org.revapi.base
Class BaseTreeFilter<E extends Element<E>>
- java.lang.Object
-
- org.revapi.base.BaseTreeFilter<E>
-
- Type Parameters:
E
- the parent type of all elements produced by an API analyzer
- All Implemented Interfaces:
TreeFilter<E>
- Direct Known Subclasses:
IncludeExcludeTreeFilter
,IndependentTreeFilter
public class BaseTreeFilter<E extends Element<E>> extends Object implements TreeFilter<E>
A convenience base class for tree filters. This base class doesn't match any elements ever.
-
-
Constructor Summary
Constructors Constructor Description BaseTreeFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<E,FilterFinishResult>
finish()
Called after all elements have been processed to see if any of them have changed in their filtering result (which could be the case if there are dependencies between elements other than that of parent-child).FilterFinishResult
finish(E element)
This method is called after the filtering hasstarted
and all children have been processed by this filter.FilterStartResult
start(E element)
This method is called when an element is about to be filtered.
-
-
-
Method Detail
-
start
public FilterStartResult start(E element)
Description copied from interface:TreeFilter
This method is called when an element is about to be filtered. After this call all the children will be processed (if the result instructs the caller to do so). Only after that, theTreeFilter.finish(Element)
will be called with the same element as this method.- Specified by:
start
in interfaceTreeFilter<E extends Element<E>>
- Parameters:
element
- the element to start filtering- Returns:
- a filter result informing the caller what was the result of filtering and whether to descend to children or not
-
finish
public FilterFinishResult finish(E element)
Description copied from interface:TreeFilter
This method is called after the filtering hasstarted
and all children have been processed by this filter.Note that the result can still be
Ternary.UNDECIDED
. It is expected that such elements will in the end be resolved with theTreeFilter.finish()
method.- Specified by:
finish
in interfaceTreeFilter<E extends Element<E>>
- Parameters:
element
- the element for which the filtering has finished- Returns:
- the result of filtering
-
finish
public Map<E,FilterFinishResult> finish()
Description copied from interface:TreeFilter
Called after all elements have been processed to see if any of them have changed in their filtering result (which could be the case if there are dependencies between elements other than that of parent-child).Note that the result can remain
Ternary.UNDECIDED
. It is upon the caller to then decide what to do with such elements.- Specified by:
finish
in interfaceTreeFilter<E extends Element<E>>
- Returns:
- the final results for elements that were previously undecided if their filtering status changed
-
-