| 限定符和类型 | 方法和说明 |
|---|---|
static <T> T |
cast(Object obj,
Type type)
转换为指定的数据类型
|
static Collection |
createCollection(Type type)
创建集合
|
static Collection |
createCollection(Type type,
int size)
创建集合
|
static Map<Object,Object> |
createMap(Type type)
创建一个 map
|
static Type |
getCollectionItemType(Type collectionType)
获取集合元素类型
|
static Class |
getGenericParamType(Type genericType)
获取泛型参数类型
|
static Class |
getGenericParamType(Type genericType,
int paramIndex)
获取泛型参数类型
|
static Class |
getGenericType(Type type)
获取泛型类型
|
static Pair<Type,Type> |
getMapKeyValueType(Type mapType)
根据 map 的类型,获取对应的 key/value 类型
|
public static Collection createCollection(Type type)
type - 类型public static Map<Object,Object> createMap(Type type)
type - 类型public static Pair<Type,Type> getMapKeyValueType(Type mapType)
mapType - map 类型public static Collection createCollection(Type type, int size)
type - 类型size - 集合大小public static Class getGenericType(Type type)
type - 类型public static Type getCollectionItemType(Type collectionType)
collectionType - 集合类型public static Class getGenericParamType(Type genericType, int paramIndex)
genericType - 类型paramIndex - 泛型参数下标public static Class getGenericParamType(Type genericType)
genericType - 类型Copyright © 2024. All rights reserved.