public class ReflectTool extends Object
Constructor and Description |
---|
ReflectTool() |
Modifier and Type | Method and Description |
---|---|
static Class |
defineClass(String className,
byte[] b,
ClassLoader loader) |
static Class |
defineClass(String className,
byte[] b,
ClassLoader loader,
ProtectionDomain protectionDomain) |
static Class<?> |
getGenericFieldType(Class<?> clazz,
Field field)
泛型类clazz,field字段的真实class对象.
|
static Type |
getInheritGenericType(Class<?> clazz,
Type type)
获取泛型类中type对应的真实Type
|
static Type |
getInheritGenericType(Class<?> clazz,
TypeVariable<?> tv)
获取泛型类clazz中某个TypeVariable对应的真实Type.
|
static Class<?> |
getParameterRealGenericClass(Class<?> clazz,
Type type,
int index)
获取泛型类参数的实际类型.例如 Map
|
static ProtectionDomain |
getProtectionDomain(Class source) |
static Class<?> |
getRealGenericClass(Class<?> clazz,
Type type)
获取泛型类中type变量对应的真实class
|
public static ProtectionDomain getProtectionDomain(Class source)
public static Class defineClass(String className, byte[] b, ClassLoader loader) throws Exception
Exception
public static Class defineClass(String className, byte[] b, ClassLoader loader, ProtectionDomain protectionDomain) throws Exception
Exception
public static Class<?> getGenericFieldType(Class<?> clazz, Field field)
clazz
- 泛型classfield
- 字段public static Class<?> getParameterRealGenericClass(Class<?> clazz, Type type, int index)
clazz
- 泛型基类.type
- 泛型基类中的某个typepublic static Class<?> getRealGenericClass(Class<?> clazz, Type type)
clazz
- 泛型基类.type
- 泛型基类中的某个typepublic static Type getInheritGenericType(Class<?> clazz, Type type)
clazz
- type
- public static Type getInheritGenericType(Class<?> clazz, TypeVariable<?> tv)
clazz
- tv
- Copyright © 2017. All rights reserved.