Package spoon.reflect.visitor.filter
Class CtScannerFunction
java.lang.Object
spoon.reflect.visitor.filter.CtScannerFunction
- All Implemented Interfaces:
CtConsumableFunction<CtElement>
,CtQueryAware
public class CtScannerFunction
extends Object
implements CtConsumableFunction<CtElement>, CtQueryAware
Returns all children of an element.
More than this, it is a parameterizable class to be subclassed which provides all the power of
In particular, one can a register a
CtScanner
in the context of queries.
In particular, one can a register a
CtScannerListener
, it is called-back when entering/exiting each scanned AST node
and it drives the scanning process (see ScanningMode
).-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
apply(CtElement input, CtConsumer<Object> outputConsumer)
Evaluates the function on the given input.includingSelf(boolean includingSelf)
setListener(CtScannerListener listener)
void
This method is called when the filter/function is added as a step to aCtQuery
by the query engine (CtQueryImpl
).
-
Constructor Details
-
CtScannerFunction
public CtScannerFunction()
-
-
Method Details
-
includingSelf
- Parameters:
includingSelf
- if true then input element is sent to output too. By default it is false.
-
setListener
- Parameters:
listener
- the implementation ofCtScannerListener
, which will listen for enter/exit of nodes during scanning of AST- Returns:
- this to support fluent API
-
apply
Description copied from interface:CtConsumableFunction
Evaluates the function on the given input.- Specified by:
apply
in interfaceCtConsumableFunction<CtElement>
- Parameters:
input
- the input of the functionoutputConsumer
- the consumer which accepts the results of this function.
-
setQuery
Description copied from interface:CtQueryAware
This method is called when the filter/function is added as a step to aCtQuery
by the query engine (CtQueryImpl
).- Specified by:
setQuery
in interfaceCtQueryAware
- Parameters:
query
- an instance registering this function/filter.
-