Package spoon.reflect.visitor
Class Query
- java.lang.Object
-
- spoon.reflect.visitor.Query
-
public abstract class Query extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <E extends CtElement>
List<E>getElements(CtElement rootElement, Filter<E> filter)
Returns all the program elements that match the filter starting from the given rootElement.static <E extends CtElement>
List<E>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 Detail
-
getElements
public static <E extends CtElement> List<E> getElements(Factory factory, Filter<E> filter)
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
public static <E extends CtElement> List<E> getElements(CtElement rootElement, Filter<E> filter)
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
public 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.- 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
-
-