Skip to content

Instantly share code, notes, and snippets.

@yuanliwei
Created December 14, 2015 03:48
Show Gist options
  • Save yuanliwei/1e7c795d5f87004ff8db to your computer and use it in GitHub Desktop.
Save yuanliwei/1e7c795d5f87004ff8db to your computer and use it in GitHub Desktop.
通过反射访问对象属性值

通过反射访问对象属性值

        try {
            Class<?> clazz = object.getClass();
            Field filed = clazz.getDeclaredField("filedName");
            filed.setAccessible(true);
            Map<String, Queue<Request<?>>> map = (Map<String, Queue<Request<?>>>) filed.get(queue);
            Logger.info("HHHHH - map.size() : " + map.size());
        } catch (Exception e) {
            Logger.error(e.getMessage(), e);
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment