替换switch case方法的方式2--反射

来源:互联网 发布:组卷 源码 编辑:程序博客网 时间:2024/06/18 16:52

public static final HashMap<Integer, String> sMethods;public static final int GET_NEW_APPS=96;static {    sMethods.put(GET_NEW_APPS, "getFirstApps");} final String method =sMethods.get(mAction); final Method m = clazz.getMethod(method); m.invoke();


原创粉丝点击