public class Types extends Object
| 构造器和说明 |
|---|
Types() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Type |
getActualType(Type type,
TypeVariable<?> typeVariable)
获得泛型变量对应的泛型实际类型,如果此变量没有对应的实际类型,返回null
|
static Class<?> |
getArrayClass(Class componentClass) |
static Class<?> |
getClass(Type type)
获得Type对应的原始类,如果无法获取原始类,返回Object.class
|
static Object |
getDefaultValue(Class<?> clazz) |
static Object[] |
getDefaultValues(Class<?>... classes) |
static Class |
getPrimitiveClassByName(String type) |
static Class |
getPrimitiveClassByWrapper(Class type) |
static Type |
getType(Field field)
获取字段对应的Type类型, 优先获取GenericType,获取不到则获取Type
|
static Type |
getTypeArgument(Type type) |
static Type |
getTypeArgument(Type type,
int index) |
static Type[] |
getTypeArguments(Type type) |
static Map<TypeVariable<?>,Type> |
getTypeVariableMap(Type type)
获取泛型变量和泛型实际类型的对应关系Map
|
static Class<?> |
getWrapperClass(Class<?> type)
获取包装类型
|
static boolean |
isAssignable(Class<?>[] definedTypes,
Class<?>[] checkedTypes) |
static boolean |
isAssignable(Class<?> definedType,
Class<?> checkedType) |
static boolean |
isEquals(Class<?>[] definedTypes,
Class<?>[] checkedTypes) |
static boolean |
isFunction(Class type) |
static boolean |
isLambda(Object obj)
推测是否为Lambda表达式对象,
|
static boolean |
isPrimitive(Class<?> clazz) |
static boolean |
isPrimitiveWrapper(Class<?> clazz) |
static boolean |
isUnknown(Type type) |
static ParameterizedType |
toParameterizedType(Type type) |
public static boolean isPrimitive(Class<?> clazz)
public static boolean isPrimitiveWrapper(Class<?> clazz)
@Nullable public static ParameterizedType toParameterizedType(Type type)
public static Map<TypeVariable<?>,Type> getTypeVariableMap(Type type)
public static Type getActualType(Type type, TypeVariable<?> typeVariable)
public static boolean isUnknown(Type type)
@Nonnull public static Class<?> getClass(@Nonnull Type type)
public static boolean isFunction(Class type)
Copyright © 2024 fossc. All rights reserved.