Modifier and Type | Class and Description |
---|---|
static class |
Types.ArrayType
Array type.
|
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 and Type | Method and Description |
---|---|
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.
|
static void |
discard(Object o) |
static PseudoField |
field(Field field) |
static Type |
getComponentType(Type type)
Returns the component type of an array.
|
static Type |
getElementType(Type type)
Returns the element type of a
Collection , Iterable
(including Queryable and
Enumerable ), Iterator ,
Enumerator , or an array. |
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 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) |
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.
public static Type getComponentType(Type type)
public static boolean isArray(Type type)
public static PseudoField nthField(int ordinal, Type clazz)
public 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)
public static Expression castIfNecessary(Type returnType, Expression expression)
returnType
- Desired typeexpression
- Expressionpublic static PseudoField field(Field field)
Copyright © 2012-2014 Julian Hyde. All Rights Reserved.