public class ActualTypeMapperPool extends Object
Constructor and Description |
---|
ActualTypeMapperPool() |
Modifier and Type | Method and Description |
---|---|
static Map<Type,Type> |
get(Type type)
获取泛型变量和泛型实际类型的对应关系Map
|
static Type |
getActualType(Type type,
GenericArrayType genericArrayType)
获得泛型变量对应的泛型实际类型,如果此变量没有对应的实际类型,返回null
|
static Type |
getActualType(Type type,
TypeVariable<?> typeVariable)
获得泛型变量对应的泛型实际类型,如果此变量没有对应的实际类型,返回null
|
static Type[] |
getActualTypes(Type type,
Type... typeVariables)
获取指定泛型变量对应的真实类型
由于子类中泛型参数实现和父类(接口)中泛型定义位置是一一对应的,因此可以通过对应关系找到泛型实现类型 |
static Map<String,Type> |
getStrKeyMap(Type type)
获取泛型变量名(字符串)和泛型实际类型的对应关系Map
|
public static Map<Type,Type> get(Type type)
type
- 被解析的包含泛型参数的类public static Map<String,Type> getStrKeyMap(Type type)
type
- 被解析的包含泛型参数的类public static Type getActualType(Type type, TypeVariable<?> typeVariable)
type
- 类typeVariable
- 泛型变量,例如T等public static Type getActualType(Type type, GenericArrayType genericArrayType)
type
- 类genericArrayType
- 泛型数组类型Copyright © 2025. All rights reserved.