首页 > 其他 > 详细

类的反射

时间:2019-01-16 15:20:12      阅读:100      评论:0      收藏:0      [点我收藏+]

获取方法

 
public static Set<String> getPublicMethodNames(Class<?> clazz)
public static Method[] getPublicMethods(Class<?> clazz)
public static List<Method> getPublicMethods(Class<?> clazz, Filter<Method> filter)
public static List<Method> getPublicMethods(Class<?> clazz, Method... excludeMethods)
public static List<Method> getPublicMethods(Class<?> clazz, String... excludeMethodNames)
public static Method getPublicMethod(Class<?> clazz, String methodName, Class<?>... paramTypes)
public static Set<String> getDeclaredMethodNames(Class<?> clazz)
public static Method[] getDeclaredMethods(Class<?> clazz)
public static Method getDeclaredMethodOfObj(Object obj, String methodName, Object... args)
public static Method getDeclaredMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes)
 


获取字段

 
public static Field getDeclaredField(Class<?> clazz, String fieldName)
public static Field[] getDeclaredFields(Class<?> clazz)
 


调用方法

 
public static <T> T invoke(String classNameDotMethodName, Object[] args)
public static <T> T invoke(String classNameWithMethodName, boolean isSingleton, Object... args)
public static <T> T invoke(String className, String methodName, Object[] args)
public static <T> T invoke(String className, String methodName, boolean isSingleton, Object[] args)
 

类的反射

原文:https://www.cnblogs.com/chinaifae/p/10277151.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!