Interface InvocationMatcher

All Known Subinterfaces:
BasicInvocationMatcher, GenericExternalModel
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@Incubating(since="8.1.3") @FunctionalInterface public interface InvocationMatcher
The most basic version of a MethodMatcher that allows implementers to craft custom matching logic.
  • Method Details

    • matches

      boolean matches(@Nullable org.openrewrite.java.tree.JavaType.Method type)
      Whether the method invocation or constructor matches the criteria of this matcher.
      Parameters:
      type - The type of the method invocation or constructor.
      Returns:
      True if the invocation or constructor matches the criteria of this matcher.
    • matches

      default boolean matches(@Nullable org.openrewrite.java.tree.MethodCall methodCall)
    • matches

      default boolean matches(@Nullable org.openrewrite.java.tree.Expression maybeMethod)
      Whether the method invocation or constructor matches the criteria of this matcher.
      Parameters:
      maybeMethod - Any Expression that might be a method invocation or constructor.
      Returns:
      True if the invocation or constructor matches the criteria of this matcher.
    • from

      static InvocationMatcher from(Collection<? extends InvocationMatcher> matchers)
    • fromMethodMatcher

      static InvocationMatcher fromMethodMatcher(String methodName)
      This method functions in the same way as fromMethodMatcher(new MethodMatcher(methodName)).
    • fromMethodMatcher

      static InvocationMatcher fromMethodMatcher(String methodName, @Nullable Boolean matchOverrides)
      This method functions in the same way as fromMethodMatcher(new MethodMatcher(methodName, matchOverrides)).
    • fromMethodMatcher

      static InvocationMatcher fromMethodMatcher(org.openrewrite.java.MethodMatcher methodMatcher)
    • fromMethodMatchers

      static InvocationMatcher fromMethodMatchers(org.openrewrite.java.MethodMatcher... matchers)
    • fromMethodMatchers

      static InvocationMatcher fromMethodMatchers(Collection<? extends org.openrewrite.java.MethodMatcher> matchers)
    • advanced