Class AllMethodsSameSignatureFunction

All Implemented Interfaces:
CtConsumableFunction<CtExecutable<?>>, CtQueryAware

public class AllMethodsSameSignatureFunction extends Object implements CtConsumableFunction<CtExecutable<?>>, CtQueryAware
Returns all methods/lambdas with same signature in related inheritance hierarchies. It can be be used to found all other methods, which has to be changed if signature of method or lambda expression has to be changed.
Expects CtExecutable as input and produces all CtExecutables, which have same signature and are declared in sub/super classes or sub/super interfaces of this or related inheritance hierarchy.
It makes sense to call this mapping functions for CtMethod and CtLambda instances and then it returns CtMethod and CtLambda instance which overrides each other or have same signature.
  • Constructor Details

    • AllMethodsSameSignatureFunction

      public AllMethodsSameSignatureFunction()
  • Method Details

    • includingSelf

      public AllMethodsSameSignatureFunction includingSelf(boolean includingSelf)
      includingSelf - if true then input element is sent to output too. By default it is false.
    • includingLambdas

      public AllMethodsSameSignatureFunction includingLambdas(boolean includingLambdas)
      includingLambdas - if true then extra search for CtLambda executables, with same signature will be processed too. If false, then it returns only CtMethod instances. By default it is true.
    • apply

      public void apply(CtExecutable<?> targetExecutable, CtConsumer<Object> outputConsumer)
      Description copied from interface: CtConsumableFunction
      Evaluates the function on the given input.
      Specified by:
      apply in interface CtConsumableFunction<CtExecutable<?>>
      targetExecutable - 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
      query - an instance registering this function/filter.