| Modifier and Type | Class and Description |
|---|---|
static class |
Types.ArrayType
Array type.
|
static class |
Types.MapType
Map type.
|
(package private) static class |
Types.ParameterizedTypeImpl
Implementation of
ParameterizedType. |
static interface |
Types.RecordField
Field that belongs to a record.
|
static interface |
Types.RecordType
Base class for record-like types that do not mapped to (currently
loaded) Java
Class objects. |
| Modifier | Constructor and Description |
|---|---|
private |
Types() |
| Modifier and Type | Method and Description |
|---|---|
(package private) static boolean |
allAssignable(boolean varArgs,
Class[] parameterTypes,
Class[] argumentTypes) |
(package private) static Class |
arrayClass(Type type) |
(package private) static Type |
arrayType(Type type) |
(package private) static Type |
arrayType(Type type,
int dimension) |
private static boolean |
assignableFrom(Class parameter,
Class argument)
Returns whether a parameter is assignable from an argument by virtue
of (a) sub-classing (e.g.
|
static Type |
box(Type type) |
static Expression |
castIfNecessary(Type returnType,
Expression expression)
Wraps an expression in a cast if it is not already of the desired type,
or cannot be implicitly converted to it.
|
(package private) static String |
className(Type type) |
static void |
discard(Object o) |
static PseudoField |
field(Field field) |
(package private) static Type |
gcd(Type... types)
Returns the most restrictive type that is assignable from all given
types.
|
static Type |
getComponentType(Type type)
Returns the component type of an array.
|
(package private) static Type |
getComponentTypeN(Type type) |
static Type |
getElementType(Type type)
Returns the element type of a
Collection, Iterable
(including Queryable and
Enumerable), Iterator,
Enumerator, or an array. |
(package private) static Field |
getField(String fieldName,
Class clazz) |
(package private) static PseudoField |
getField(String fieldName,
Type type) |
private static Types.RecordField |
getRecordField(String fieldName,
Types.RecordType type) |
private static Types.RecordField |
getSystemField(String fieldName,
Class clazz) |
static boolean |
isArray(Type type) |
static boolean |
isAssignableFrom(Type type0,
Type type) |
static Constructor |
lookupConstructor(Type type,
Class... argumentTypes)
Finds a constructor of a given class that accepts a given set of
arguments.
|
static Field |
lookupField(Type type,
String name) |
static Method |
lookupMethod(Class clazz,
String methodName,
Class... argumentTypes)
Finds a method of a given name that accepts a given set of arguments.
|
static Field |
nthField(int ordinal,
Class clazz) |
static PseudoField |
nthField(int ordinal,
Type clazz) |
static Type |
of(Type type,
Type... typeArguments)
Creates a type with generic parameters.
|
static Type |
stripGenerics(Type type) |
static Class |
toClass(Type type) |
(package private) static Class[] |
toClassArray(Collection<Type> types) |
(package private) static Class[] |
toClassArray(Iterable<? extends Expression> arguments) |
private static <T> List<T> |
toList(T[] ts)
Returns a list backed by a copy of an array.
|
static Type |
unbox(Type type) |
public static Type getElementType(Type type)
Collection, Iterable
(including Queryable and
Enumerable), Iterator,
Enumerator, or an array.
Returns null if the type is not one of these.
private static <T> List<T> toList(T[] ts)
static PseudoField getField(String fieldName, Type type)
private static Types.RecordField getRecordField(String fieldName, Types.RecordType type)
private static Types.RecordField getSystemField(String fieldName, Class clazz)
static Class[] toClassArray(Collection<Type> types)
static Class[] toClassArray(Iterable<? extends Expression> arguments)
public static Type getComponentType(Type type)
public static boolean isArray(Type type)
public static PseudoField nthField(int ordinal, Type clazz)
static boolean allAssignable(boolean varArgs,
Class[] parameterTypes,
Class[] argumentTypes)
private static boolean assignableFrom(Class parameter, Class argument)
parameter - Parameter typeargument - Argument typepublic static Method lookupMethod(Class clazz, String methodName, Class... argumentTypes)
clazz - Class against which method is invokedmethodName - Name of methodargumentTypes - Types of argumentsRuntimeException - if method not foundpublic static Constructor lookupConstructor(Type type, Class... argumentTypes)
type - Class against which method is invokedargumentTypes - Types of argumentsRuntimeException - if method not foundpublic static void discard(Object o)
static Type gcd(Type... types)
public static Expression castIfNecessary(Type returnType, Expression expression)
returnType - Desired typeexpression - Expressionpublic static PseudoField field(Field field)
Copyright © 2012–2021 The Apache Software Foundation. All rights reserved.