Class Suppliers

java.lang.Object
com.google.errorprone.suppliers.Suppliers

public final class Suppliers extends Object
Author:
alexeagle@google.com (Alex Eagle)
  • Field Details

    • JAVA_LANG_VOID_TYPE

      public static final Supplier<com.sun.tools.javac.code.Type> JAVA_LANG_VOID_TYPE
    • VOID_TYPE

      public static final Supplier<com.sun.tools.javac.code.Type> VOID_TYPE
    • JAVA_LANG_BOOLEAN_TYPE

      public static final Supplier<com.sun.tools.javac.code.Type> JAVA_LANG_BOOLEAN_TYPE
    • JAVA_LANG_INTEGER_TYPE

      public static final Supplier<com.sun.tools.javac.code.Type> JAVA_LANG_INTEGER_TYPE
    • JAVA_LANG_LONG_TYPE

      public static final Supplier<com.sun.tools.javac.code.Type> JAVA_LANG_LONG_TYPE
    • STRING_TYPE

      public static final Supplier<com.sun.tools.javac.code.Type> STRING_TYPE
    • BOOLEAN_TYPE

      public static final Supplier<com.sun.tools.javac.code.Type> BOOLEAN_TYPE
    • BYTE_TYPE

      public static final Supplier<com.sun.tools.javac.code.Type> BYTE_TYPE
    • SHORT_TYPE

      public static final Supplier<com.sun.tools.javac.code.Type> SHORT_TYPE
    • INT_TYPE

      public static final Supplier<com.sun.tools.javac.code.Type> INT_TYPE
    • LONG_TYPE

      public static final Supplier<com.sun.tools.javac.code.Type> LONG_TYPE
    • DOUBLE_TYPE

      public static final Supplier<com.sun.tools.javac.code.Type> DOUBLE_TYPE
    • CHAR_TYPE

      public static final Supplier<com.sun.tools.javac.code.Type> CHAR_TYPE
    • OBJECT_TYPE

      public static final Supplier<com.sun.tools.javac.code.Type> OBJECT_TYPE
    • EXCEPTION_TYPE

      public static final Supplier<com.sun.tools.javac.code.Type> EXCEPTION_TYPE
    • THROWABLE_TYPE

      public static final Supplier<com.sun.tools.javac.code.Type> THROWABLE_TYPE
    • ANNOTATION_TYPE

      public static final Supplier<com.sun.tools.javac.code.Type> ANNOTATION_TYPE
    • ENCLOSING_CLASS

      public static final Supplier<com.sun.tools.javac.code.Type> ENCLOSING_CLASS
  • Method Details

    • genericTypeOf

      public static Supplier<com.sun.tools.javac.code.Type> genericTypeOf(Supplier<com.sun.source.tree.ExpressionTree> expressionSupplier, int n)
      Supplies the n'th generic type of the given expression. For example, in Map<A,B> c; for the expression c and n=1, the result is the type of B. If there are an insufficient number of type arguments, this method will return the java.lang.Object type from symbol table.
      Parameters:
      expressionSupplier - a supplier of the expression which has a generic type
      n - the position of the generic argument
    • genericTypeOfType

      public static Supplier<com.sun.tools.javac.code.Type> genericTypeOfType(Supplier<com.sun.tools.javac.code.Type> typeSupplier, int n)
      Supplies the n'th generic type of the given expression. For example, in Map<A,B> c; for the type of c and n=1, the result is the type of B. If there are an insufficient number of type arguments, this method will return the java.lang.Object type from symbol table.
      Parameters:
      typeSupplier - a supplier of the expression which has a generic type
      n - the position of the generic argument
    • receiverType

      public static Supplier<com.sun.tools.javac.code.Type> receiverType()
      Supplies the expression which gives the instance of an object that will receive the method call. For example, in a.getB().getC() if the visitor is currently visiting the getC() method invocation, then this supplier gives the expression a.getB().
    • receiverInstance

      public static Supplier<com.sun.source.tree.ExpressionTree> receiverInstance()
      Supplies the expression which gives the instance of an object that will receive the method call. For example, in a.getB().getC() if the visitor is currently visiting the getC() method invocation, then this supplier gives the expression a.getB().
    • typeFromString

      public static Supplier<com.sun.tools.javac.code.Type> typeFromString(String typeString)
      Given the string representation of a type, supplies the corresponding type.
      Parameters:
      typeString - a string representation of a type, e.g., "java.util.List"
    • typeFromClass

      public static Supplier<com.sun.tools.javac.code.Type> typeFromClass(Class<?> inputClass)
      Given the class representation of a type, supplies the corresponding type.
    • identitySupplier

      public static <T> Supplier<T> identitySupplier(T toSupply)
      Supplies what was given. Useful for adapting to methods that require a supplier.
      Parameters:
      toSupply - the item to supply
    • arrayOf

      public static Supplier<com.sun.tools.javac.code.Type> arrayOf(Supplier<com.sun.tools.javac.code.Type> elementType)
    • fromStrings

      public static com.google.common.collect.ImmutableList<Supplier<com.sun.tools.javac.code.Type>> fromStrings(Iterable<String> types)