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)
     
  • 相关阅读:
    TX2--安装跑一python3.5
    luogu P4762 [CERC2014]Virus synthesis (回文自动机)
    牛客 128A 礼物 (组合计数)
    后缀自动机学习
    Codeforces Round #309 (Div. 1)
    Vanya and Scales CodeForces
    5-45 航空公司VIP客户查询 (25分) HASH
    转载 字符串hash
    5-15 QQ帐户的申请与登陆 (25分) HASH
    5-14 电话聊天狂人 (25分) HASH
  • 原文地址:https://www.cnblogs.com/chinaifae/p/10277151.html
Copyright © 2011-2022 走看看