java.lang.Object
org.miaixz.bus.mapper.builder.GenericTypeResolver
泛型类型解析器,基于 MyBatis 3 的源码,添加了 resolveMapperTypes 方法以支持接口泛型解析 源码来自 https://github.com/mybatis/mybatis-3
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class泛型数组类型实现类static class参数化类型实现类static class通配符类型实现类 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Class<?> getReturnType(Method method, Class<?> srcType) 获取方法的实际返回值类型static Class<?> resolveFieldClass(Field field, Type srcType) 解析字段的实际类类型static TyperesolveFieldType(Field field, Type srcType) 解析字段的泛型类型static Type[]resolveMapperTypes(Class<?> srcType) 解析接口的泛型类型static Type[]resolveMapperTypes(Method method, Type srcType) 解析方法所在接口的泛型类型static Type[]resolveParamTypes(Method method, Type srcType) 解析方法的参数类型static TyperesolveReturnType(Method method, Type srcType) 解析方法的返回值类型static TyperesolveType(Type type, Type srcType, Class<?> declaringClass) 解析泛型类型static Class<?> resolveTypeToClass(Type type) 将 Type 转换为 Class 类型
-
Constructor Details
-
GenericTypeResolver
public GenericTypeResolver()私有构造函数,防止实例化
-
-
Method Details
-
getReturnType
获取方法的实际返回值类型- Parameters:
method- 方法srcType- 方法所属类- Returns:
- 方法返回值实际类型
-
resolveMapperTypes
解析接口的泛型类型- Parameters:
srcType- 接口类型- Returns:
- 接口上的泛型参数实际类型数组
-
resolveMapperTypes
解析方法所在接口的泛型类型- Parameters:
method- 方法srcType- 接口类型- Returns:
- 接口上的泛型参数实际类型数组
-
resolveFieldType
解析字段的泛型类型- Parameters:
field- 字段srcType- 源类型- Returns:
- 字段的实际类型
-
resolveFieldClass
解析字段的实际类类型- Parameters:
field- 字段srcType- 源类型- Returns:
- 字段的实际类类型
-
resolveTypeToClass
将 Type 转换为 Class 类型- Parameters:
type- 类型- Returns:
- 对应的 Class 类型
-
resolveReturnType
解析方法的返回值类型- Parameters:
method- 方法srcType- 源类型- Returns:
- 方法返回值的实际类型
-
resolveParamTypes
解析方法的参数类型- Parameters:
method- 方法srcType- 源类型- Returns:
- 方法参数的实际类型数组
-
resolveType
解析泛型类型- Parameters:
type- 类型srcType- 源类型declaringClass- 声明类- Returns:
- 解析后的实际类型
-