Package spoon.reflect.visitor
Class Query
java.lang.Object
spoon.reflect.visitor.Query
-
Method Summary
Modifier and TypeMethodDescriptiongetElements(CtElement rootElement, Filter<E> filter)
Returns all the program elements that match the filter starting from the given rootElement.getElements(Factory factory, Filter<E> filter)
Within a given factory, returns all the program elements that match the filter.static <T extends CtReference>
List<T>getReferences(CtElement rootElement, Filter<T> filter)
Returns all the program element references that match the filter.static <R extends CtReference>
List<R>getReferences(Factory factory, Filter<R> filter)
Within a given factory, returns all the program element references that match the filter.
-
Method Details
-
getElements
Within a given factory, returns all the program elements that match the filter.- Type Parameters:
E
- the type of the sought program elements- Parameters:
factory
- the factory that contains the elements where to recursive search onfilter
- the filter which defines the matching criteria
-
getElements
Returns all the program elements that match the filter starting from the given rootElement. UseCtQueryable.map(CtFunction)
if you need more control on the scanning context of the Filter.- Type Parameters:
E
- the type of the sought program elements- Parameters:
rootElement
- the element to start the recursive search onfilter
- the filter which defines the matching criteria
-
getReferences
public static <T extends CtReference> List<T> getReferences(CtElement rootElement, Filter<T> filter)Returns all the program element references that match the filter.- Type Parameters:
T
- the type of the sought program element references- Parameters:
rootElement
- the element to start the recursive search onfilter
- the filter which defines the matching criteria
-
getReferences
Within a given factory, returns all the program element references that match the filter.- Type Parameters:
R
- the type of the sought program element references- Parameters:
factory
- the factory that contains the references where to recursive search onfilter
- the filter which defines the matching criteria
-