public class Generics extends Object
非泛型类型返回 null 而非 Object
| Modifier and Type | Method and Description |
|---|---|
static Class<?> |
getClassGenericType(TypeReference<?> ref,
int genericIndex)
获取类类型泛型
|
static Class<?>[] |
getClassGenericTypes(TypeReference<?> ref)
获取类类型泛型列表
|
static Class<?> |
getFieldGenericType(Field field,
int genericIndex)
获取字段泛型
|
static Class<?>[] |
getFieldGenericTypes(Field field)
获取字段泛型列表
|
static Class<?> |
getInterfaceGenericType(Class<?> clazz,
Class<?> interfaceClass,
int genericIndex)
获取接口泛型
|
static Map<Class<?>,Class<?>[]> |
getInterfaceGenericTypes(Class<?> clazz)
获取接口泛型列表
|
static Class<?>[] |
getInterfaceGenericTypes(Class<?> clazz,
Class<?> interfaceClass)
获取接口泛型列表
|
static Class<?> |
getMethodParameterGenericType(Method method,
int parameterIndex,
int genericIndex)
获取方法参数泛型
|
static Class<?>[][] |
getMethodParameterGenericTypes(Method method)
获取方法参数泛型列表
|
static Class<?>[] |
getMethodParameterGenericTypes(Method method,
int parameterIndex)
获取方法参数泛型列表
|
static Class<?> |
getMethodReturnGenericType(Method method,
int genericIndex)
获取字段泛型
|
static Class<?>[] |
getMethodReturnGenericTypes(Method method)
获取字段泛型列表
|
static Class<?> |
getSuperClassGenericType(Class<?> clazz,
int genericIndex)
获取父类泛型
|
static Class<?>[] |
getSuperClassGenericTypes(Class<?> clazz)
获取父类泛型列表
|
public static Class<?> getFieldGenericType(Field field, int genericIndex)
field - fieldgenericIndex - generic type genericIndexpublic static Class<?>[] getFieldGenericTypes(Field field)
field - fieldpublic static Class<?> getMethodParameterGenericType(Method method, int parameterIndex, int genericIndex)
method - methodparameterIndex - parameterIndexgenericIndex - genericIndexpublic static Class<?>[] getMethodParameterGenericTypes(Method method, int parameterIndex)
method - methodparameterIndex - indexpublic static Class<?>[][] getMethodParameterGenericTypes(Method method)
method - methodpublic static Class<?> getMethodReturnGenericType(Method method, int genericIndex)
method - methodgenericIndex - genericIndexpublic static Class<?>[] getMethodReturnGenericTypes(Method method)
method - methodpublic static Class<?> getClassGenericType(TypeReference<?> ref, int genericIndex)
ref - refgenericIndex - genericIndexpublic static Class<?>[] getClassGenericTypes(TypeReference<?> ref)
ref - refpublic static Class<?> getSuperClassGenericType(Class<?> clazz, int genericIndex)
clazz - clazzgenericIndex - genericIndexpublic static Class<?>[] getSuperClassGenericTypes(Class<?> clazz)
clazz - clazzpublic static Class<?> getInterfaceGenericType(Class<?> clazz, Class<?> interfaceClass, int genericIndex)
clazz - clazzinterfaceClass - 接口类型genericIndex - genericIndexpublic static Class<?>[] getInterfaceGenericTypes(Class<?> clazz, Class<?> interfaceClass)
clazz - clazzinterfaceClass - 接口类型Copyright © 2025. All rights reserved.