zoukankan      html  css  js  c++  java
  • 类的反射

    获取方法

     
    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)
     
  • 相关阅读:
    Ymodem协议(参考STM32)
    嵌入式 Linux 对内存的直接读写(devmem)
    四则运算表达式分解,前中后缀表达式(栈的应用)
    I2C总线的仲裁机制
    用例图【图7】--☆
    顺序图【6】--☆☆
    部署图【图5】--☆
    组件图【图4】--☆
    活动图、泳道【图1】--☆☆
    Mybatis增删改查(CURD)
  • 原文地址:https://www.cnblogs.com/chinaifae/p/10277151.html
Copyright © 2011-2022 走看看