Class CallPattern

java.lang.Object
io.micronaut.errorprone.noreflection.CallPattern

public final class CallPattern extends Object
Calls named the way a build writes them: a type or a package, then # and the members.
  • java.lang.Class#getSimpleName - a method of the class, whatever its parameters
  • java.lang.Class#getSimpleName|getCanonicalName - either of the two
  • java.util.EnumMap#<init> - the constructors of the class
  • java.util.EnumSet#*, or java.util.EnumSet alone - any method or constructor of it
  • io.micronaut.core.reflect.ReflectionUtils#*-getWrapperType|getPrimitiveType - any but those
  • java.lang.reflect.AnnotatedElement+#getAnnotation - declared by the type or by a subtype of it
  • java.lang.invoke.*#* - of a type of the package, or of a package below it

A nested type is named either way, java.util.ServiceLoader.Provider or java.util.ServiceLoader$Provider. A pattern holds names only; the checks match it against the method the compiler resolved a call, a method reference or a constructor to.

Since:
1.0.0
Author:
Denis Stepanov
  • Method Details

    • parse

      public static CallPattern parse(String text)
      Parameters:
      text - The pattern
      Returns:
      The pattern parsed
      Throws:
      IllegalArgumentException - When it is not a pattern, saying why and what one looks like
    • owner

      public String owner()
      Returns:
      The type or package named
    • ownerMatch

      public CallPattern.OwnerMatch ownerMatch()
      Returns:
      How the type is matched
    • matchesMember

      public boolean matchesMember(String name)
      Parameters:
      name - The simple name of a method, or <init>
      Returns:
      Whether the pattern names it
    • namesType

      public boolean namesType(String qualifiedName, String flatName)
      Parameters:
      qualifiedName - The qualified name of a class
      flatName - Its flat name, with a nested class joined by $
      Returns:
      Whether the class is the type the pattern names
    • coversPackage

      public boolean coversPackage(String packageName)
      Parameters:
      packageName - The name of a package
      Returns:
      Whether it is the package the pattern names or a package below it
    • toString

      public String toString()
      Overrides:
      toString in class Object