Package spoon.reflect.visitor.filter
Class LineFilter
- All Implemented Interfaces:
Filter<CtStatement>
This filter matches all elements that can be considered as line of code (e.g. directly contained in a block, or a then statement). This discards CtStatement that are not used as statement (such as a method call used as RHS).
// lines of a method List<CtStatement> lines = method.getElements(new LineFilter()); // find the parent that is used as a statement (in a block or in a branch) CtStatement parentStatement = element.getParent(new LineFilter());
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
matches(CtStatement element)
Tells if the given element matches.Methods inherited from class spoon.reflect.visitor.filter.AbstractFilter
getType
-
Constructor Details
-
LineFilter
public LineFilter()Creates the filter.
-
-
Method Details
-
matches
Description copied from interface:Filter
Tells if the given element matches.- Specified by:
matches
in interfaceFilter<CtStatement>
- Overrides:
matches
in classAbstractFilter<CtStatement>
- Parameters:
element
- - the element to be checked for a match. Parameter element is never null ifQuery
is used.
-