Class Api

java.lang.Object
com.google.errorprone.bugpatterns.checkreturnvalue.Api

public abstract class Api extends Object
Represents a Java method or constructor.

Provides a method to parse an API from a string format, and emit an API as the same sting.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Api()
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract String
    Returns the fully qualified type that contains the given method/constructor.
    abstract String
    Returns the simple name of the method.
    abstract com.google.common.collect.ImmutableList<String>
    Returns the list of fully qualified parameter types for the given method/constructor.
    static Api
    Parses an API string into an Api, ignoring trailing or inner whitespace between names.
    final String
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Api

      public Api()
  • Method Details

    • className

      public abstract String className()
      Returns the fully qualified type that contains the given method/constructor.
    • methodName

      public abstract String methodName()
      Returns the simple name of the method. If the API is a constructor (i.e., isConstructor() == true), then "<init>" is returned.
    • parameterTypes

      public abstract com.google.common.collect.ImmutableList<String> parameterTypes()
      Returns the list of fully qualified parameter types for the given method/constructor.
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • parse

      public static Api parse(String api)
      Parses an API string into an Api, ignoring trailing or inner whitespace between names.

      Example API strings are:

      • a constructor (e.g., java.net.URI#<init>(java.lang.String))
      • a static method (e.g., java.net.URI#create(java.lang.String))
      • an instance method (e.g., java.util.List#get(int))
      • an instance method with types erased (e.g., java.util.List#add(java.lang.Object))
      Throws:
      IllegalArgumentException - when api is not well-formed