Interface GenericExternalModel

All Superinterfaces:
BasicInvocationMatcher, InvocationMatcher

public interface GenericExternalModel extends BasicInvocationMatcher
  • Method Details

    • indexedMatcher

      static InvocationMatcher indexedMatcher(Collection<? extends GenericExternalModel> models)
      Builds an InvocationMatcher that matches any of models, indexed by method name.

      A model can only match a call when its (effective) method name equals the call's name — see matchesMethodName(String) — so dispatching on JavaType.Method.getName() and only checking the models registered under that name yields exactly the same result as scanning every model, but turns the per-call cost from O(models of this flow shape) into O(1) plus the handful of same-named models. This matters because the model set is large (tens of thousands of rows).

    • getNamespace

      String getNamespace()
    • getType

      String getType()
    • isSubtypes

      boolean isSubtypes()
    • getName

      String getName()
    • getSignature

      String getSignature()
    • getArguments

      String getArguments()
    • getFullyQualifiedName

      default String getFullyQualifiedName()
    • isConstructor

      default boolean isConstructor()
    • isMatchOverrides

      default boolean isMatchOverrides()
      Specified by:
      isMatchOverrides in interface BasicInvocationMatcher
      Returns:
      True if this method matcher should match on overrides of the target type.
    • matchesTargetTypeName

      default boolean matchesTargetTypeName(String fullyQualifiedTypeName)
      Specified by:
      matchesTargetTypeName in interface BasicInvocationMatcher
    • matchesMethodName

      default boolean matchesMethodName(String methodName)
      Specified by:
      matchesMethodName in interface BasicInvocationMatcher
    • matchesParameterTypes

      default boolean matchesParameterTypes(List<org.openrewrite.java.tree.JavaType> parameterTypes)
      Specified by:
      matchesParameterTypes in interface BasicInvocationMatcher
    • getArgumentRange

      default Optional<GenericExternalModel.ArgumentRange> getArgumentRange()
    • computeArgumentRange

      static Optional<GenericExternalModel.ArgumentRange> computeArgumentRange(String arguments)
      The argument positions selected by an Argument[...] access path, as an inclusive range.

      Mirrors CodeQL's MaD selector grammar: the bracketed list is comma-separated, and each element is this (the qualifier, position -1), an integer, or an inclusive range a..b; the selector applies to the union of those positions. A comma-separated union is representable here only when it is contiguous (e.g. this,0 = {-1, 0}); a non-contiguous union (e.g. 0,2) returns empty rather than over-approximating to include positions it does not cover. Returns empty for anything that is not a bare Argument[...] selector (e.g. ReturnValue or a content-suffixed path).