Package spoon.reflect.visitor.filter
Class AllTypeMembersFunction
java.lang.Object
spoon.reflect.visitor.filter.AllTypeMembersFunction
- All Implemented Interfaces:
CtConsumableFunction<CtTypeInformation>
,CtQueryAware
public class AllTypeMembersFunction
extends Object
implements CtConsumableFunction<CtTypeInformation>, CtQueryAware
Expects
CtType
as input
and produces all CtTypeMember
s declared in input class
or any super class or super interface.
It first returns own type members, then type members of superclass, etc.-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionreturns all type membersAllTypeMembersFunction(Class<?> memberClass)
returns all type members which are instance of `memberClass`.
Example:
CtField allFields = ctType.map(new AllTypeMembersFunction(CtField.class)).list();
-
Method Summary
Modifier and TypeMethodDescriptionvoid
apply(CtTypeInformation input, CtConsumer<Object> outputConsumer)
Evaluates the function on the given input.distinctSet(Set<String> distinctSet)
The types whose qualified name is in distinctSet are not visited.void
This method is called when the filter/function is added as a step to aCtQuery
by the query engine (CtQueryImpl
).
-
Constructor Details
-
AllTypeMembersFunction
public AllTypeMembersFunction()returns all type members -
AllTypeMembersFunction
returns all type members which are instance of `memberClass`.
Example:
CtField allFields = ctType.map(new AllTypeMembersFunction(CtField.class)).list();
-
-
Method Details
-
distinctSet
The types whose qualified name is in distinctSet are not visited. The qualified name of each type visited by this mapping function is added to `distinctSet`- Parameters:
distinctSet
- - Set of qualified names of types, which has to be ignored, because they were already processed
-
apply
Description copied from interface:CtConsumableFunction
Evaluates the function on the given input.- Specified by:
apply
in interfaceCtConsumableFunction<CtTypeInformation>
- 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.
-
setMode
- Parameters:
mode
- defines how whether type members with limited visibility are returned
-