类的反射
获取方法
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)
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步