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)
     
  • 相关阅读:
    Cocos2d-x 3.0 事件系统【转】
    cocos2d-x中false,setSwallowTouches,stopPropagation的区别
    类成员函数指针 ->*语法剖析
    cocos2d-lua 3.5 ios搭建步骤
    cocos2d-lua 3.5 android搭建步骤
    cocos2d-lua 3.5 android搭建常见错误
    结构体
    乒乓球(0)<P2003_1>
    不高兴的津津(0)<P2004_1>
    陶陶摘苹果(0)<P2005_1>
  • 原文地址:https://www.cnblogs.com/chinaifae/p/10277151.html
Copyright © 2011-2022 走看看