Class ParentFunction

java.lang.Object
spoon.reflect.visitor.filter.ParentFunction
All Implemented Interfaces:
CtConsumableFunction<CtElement>, CtQueryAware

public class ParentFunction extends Object implements CtConsumableFunction<CtElement>, CtQueryAware
This Function expects a CtElement as input and returns all parents of this element. By default input is not returned, but this behavior can be changed by call of includingSelf(boolean) with value true
  • Constructor Details

    • ParentFunction

      public ParentFunction()
  • Method Details

    • includingSelf

      public ParentFunction includingSelf(boolean includingSelf)
      Parameters:
      includingSelf - if true then input element is sent to output too. By default it is false.
    • apply

      public void apply(CtElement input, CtConsumer<Object> outputConsumer)
      Description copied from interface: CtConsumableFunction
      Evaluates the function on the given input.
      Specified by:
      apply in interface CtConsumableFunction<CtElement>
      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.