java.lang.Object
cn.wjybxx.base.reflect.TypeParameterMatcher
类型参数匹配器
- 作者:
- wjybxx date 2023/4/1
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static <T> TypeParameterMatcherfindTypeMatcher(T instance, Class<? super T> superClazzOrInterface, String typeParamName) 查找指定泛型参数对应的类型匹配器。abstract booleanmatchInstance(Object instance) 查询实例是否与泛型参数匹配abstract boolean查询指定类是否是泛型参数的子类
-
构造器详细资料
-
TypeParameterMatcher
public TypeParameterMatcher()
-
-
方法详细资料
-
matchInstance
查询实例是否与泛型参数匹配- 参数:
instance- 待检测对象- 返回:
- true/false
-
matchType
查询指定类是否是泛型参数的子类- 参数:
type- 待检查的类型
-
findTypeMatcher
public static <T> TypeParameterMatcher findTypeMatcher(@Nonnull T instance, @Nonnull Class<? super T> superClazzOrInterface, @Nonnull String typeParamName) 查找指定泛型参数对应的类型匹配器。- 类型参数:
T- 约束必须有继承关系或实现关系- 参数:
instance- superClazzOrInterface的子类实例superClazzOrInterface- 泛型参数typeParamName存在的类,class或interfacetypeParamName- 泛型参数名字- 返回:
- 如果定义的泛型存在,则返回对应的泛型clazz
-