public final class ReflectCache extends Object
| 构造器和说明 |
|---|
ReflectCache() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Class<?> |
forName(String className)
加载class
|
static Field |
getDeclaredField(Class<?> cls,
String name)
获取class 字段
|
static Field[] |
getDeclaredFields(Class<?> cls)
获取class 所有字段
|
static Method |
getDeclaredMethod(Class<?> cls,
String name,
Class<?>... parameterTypes)
获取class 方法
|
static Method[] |
getDeclaredMethods(Class<?> cls)
获取方法
|
public static Class<?> forName(String className) throws ClassNotFoundException
className - 类ClassNotFoundException - 异常public static Field[] getDeclaredFields(Class<?> cls)
cls - 类public static Field getDeclaredField(Class<?> cls, String name) throws NoSuchFieldException, SecurityException
cls - clsname - nameNoSuchFieldException - 异常SecurityException - 异常public static Method getDeclaredMethod(Class<?> cls, String name, Class<?>... parameterTypes) throws NoSuchMethodException, SecurityException
cls - clsname - nameparameterTypes - typeNoSuchMethodException - 异常SecurityException - 异常public static Method[] getDeclaredMethods(Class<?> cls) throws NoSuchMethodException, SecurityException
cls - clsNoSuchMethodException - ycSecurityException - ycCopyright © 2017. All Rights Reserved.