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 CtTypeMembers declared in input class or any super class or super interface. It first returns own type members, then type members of superclass, etc.
  • Constructor Details

    • AllTypeMembersFunction

      public AllTypeMembersFunction()
      returns all type members
    • AllTypeMembersFunction

      public AllTypeMembersFunction(Class<?> memberClass)
      returns all type members which are instance of `memberClass`.
      Example:
      CtField allFields = ctType.map(new AllTypeMembersFunction(CtField.class)).list();
  • Method Details

    • distinctSet

      public AllTypeMembersFunction distinctSet(Set<String> 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

      public void apply(CtTypeInformation input, CtConsumer<Object> outputConsumer)
      Description copied from interface: CtConsumableFunction
      Evaluates the function on the given input.
      Specified by:
      apply in interface CtConsumableFunction<CtTypeInformation>
      Parameters:
      input - the input of the function
      outputConsumer - the consumer which accepts the results of this function.
    • setQuery

      public void setQuery(CtQuery query)
      Description copied from interface: CtQueryAware
      This method is called when the filter/function is added as a step to a CtQuery by the query engine (CtQueryImpl).
      Specified by:
      setQuery in interface CtQueryAware
      Parameters:
      query - an instance registering this function/filter.
    • setMode

      Parameters:
      mode - defines how whether type members with limited visibility are returned