Class FieldScopeFunction

java.lang.Object
spoon.reflect.visitor.filter.FieldScopeFunction
All Implemented Interfaces:
CtConsumableFunction<CtField<?>>

public class FieldScopeFunction extends Object implements CtConsumableFunction<CtField<?>>
This Query expects a CtField as input and returns all CtElements, which are in visibility scope of that field. In other words, it returns all elements, which might be reference to that field.
It can be used to search for variable declarations or variable references which might be in name conflict with input field.
Usage:
 
 CtField param = ...;
 param.map(new FieldScopeFunction()).forEach(...process result...);
 
 
  • Constructor Details

    • FieldScopeFunction

      public FieldScopeFunction()
  • Method Details

    • apply

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

      protected void searchForPrivateField(CtField<?> field, CtConsumer<Object> outputConsumer)
    • searchForProtectedField

      protected void searchForProtectedField(CtField<?> field, CtConsumer<Object> outputConsumer)
    • searchForPublicField

      protected void searchForPublicField(CtField<?> field, CtConsumer<Object> outputConsumer)
    • searchForPackageProtectedField

      protected void searchForPackageProtectedField(CtField<?> field, CtConsumer<Object> outputConsumer)