Package com.google.errorprone.suppliers
Class Suppliers
java.lang.Object
com.google.errorprone.suppliers.Suppliers
public final class Suppliers extends Object
- Author:
- alexeagle@google.com (Alex Eagle)
-
Field Summary
Fields Modifier and Type Field Description static Supplier<com.sun.tools.javac.code.Type>
ANNOTATION_TYPE
static Supplier<com.sun.tools.javac.code.Type>
BOOLEAN_TYPE
static Supplier<com.sun.tools.javac.code.Type>
BYTE_TYPE
static Supplier<com.sun.tools.javac.code.Type>
CHAR_TYPE
static Supplier<com.sun.tools.javac.code.Type>
DOUBLE_TYPE
static Supplier<com.sun.tools.javac.code.Type>
ENCLOSING_CLASS
static Supplier<com.sun.tools.javac.code.Type>
EXCEPTION_TYPE
static Supplier<com.sun.tools.javac.code.Type>
INT_TYPE
static Supplier<com.sun.tools.javac.code.Type>
JAVA_LANG_BOOLEAN_TYPE
static Supplier<com.sun.tools.javac.code.Type>
JAVA_LANG_INTEGER_TYPE
static Supplier<com.sun.tools.javac.code.Type>
JAVA_LANG_LONG_TYPE
static Supplier<com.sun.tools.javac.code.Type>
JAVA_LANG_VOID_TYPE
static Supplier<com.sun.tools.javac.code.Type>
LONG_TYPE
static Supplier<com.sun.tools.javac.code.Type>
OBJECT_TYPE
static Supplier<com.sun.tools.javac.code.Type>
STRING_TYPE
static Supplier<com.sun.tools.javac.code.Type>
THROWABLE_TYPE
static Supplier<com.sun.tools.javac.code.Type>
VOID_TYPE
-
Method Summary
Modifier and Type Method Description static Supplier<com.sun.tools.javac.code.Type>
arrayOf(Supplier<com.sun.tools.javac.code.Type> elementType)
static com.google.common.collect.ImmutableList<Supplier<com.sun.tools.javac.code.Type>>
fromStrings(Iterable<String> types)
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.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.static <T> Supplier<T>
identitySupplier(T toSupply)
Supplies what was given.static Supplier<com.sun.source.tree.ExpressionTree>
receiverInstance()
Supplies the expression which gives the instance of an object that will receive the method call.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.static Supplier<com.sun.tools.javac.code.Type>
typeFromClass(Class<?> inputClass)
Given the class representation of a type, supplies the corresponding type.static Supplier<com.sun.tools.javac.code.Type>
typeFromString(String typeString)
Given the string representation of a type, supplies the corresponding type.
-
Field Details
-
JAVA_LANG_VOID_TYPE
-
VOID_TYPE
-
JAVA_LANG_BOOLEAN_TYPE
-
JAVA_LANG_INTEGER_TYPE
-
JAVA_LANG_LONG_TYPE
-
STRING_TYPE
-
BOOLEAN_TYPE
-
BYTE_TYPE
-
INT_TYPE
-
LONG_TYPE
-
DOUBLE_TYPE
-
CHAR_TYPE
-
OBJECT_TYPE
-
EXCEPTION_TYPE
-
THROWABLE_TYPE
-
ANNOTATION_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, inMap<A,B> c;
for the expression c and n=1, the result is the type ofB
. If there are an insufficient number of type arguments, this method will return thejava.lang.Object
type from symbol table.- Parameters:
expressionSupplier
- a supplier of the expression which has a generic typen
- 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, inMap<A,B> c;
for the type of c and n=1, the result is the type ofB
. If there are an insufficient number of type arguments, this method will return thejava.lang.Object
type from symbol table.- Parameters:
typeSupplier
- a supplier of the expression which has a generic typen
- the position of the generic argument
-
receiverType
Supplies the expression which gives the instance of an object that will receive the method call. For example, ina.getB().getC()
if the visitor is currently visiting thegetC()
method invocation, then this supplier gives the expressiona.getB()
. -
receiverInstance
Supplies the expression which gives the instance of an object that will receive the method call. For example, ina.getB().getC()
if the visitor is currently visiting thegetC()
method invocation, then this supplier gives the expressiona.getB()
. -
typeFromString
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
Given the class representation of a type, supplies the corresponding type. -
identitySupplier
Supplies what was given. Useful for adapting to methods that require a supplier.- Parameters:
toSupply
- the item to supply
-
arrayOf
-
fromStrings
-