@Test public void testInherited() throws NoSuchFieldException, SecurityException { // sub SubClazz sub = new SubClazz(); Message msg = sub.getClass().getAnnotation(Message.class); Assert.assertEquals(false, msg.isSender()); Assert.assertEquals(true, msg.isRecver()); Plugin plgn = sub.getClass().getAnnotation(Plugin.class); Assert.assertNotNull(plgn); // super plgn = sub.getClass().getSuperclass().getAnnotation(Plugin.class); Assert.assertNotNull(plgn); // field Field f = sub.getClass().getField("str"); System.out.println(f.getDeclaringClass()); System.out.println(f.getType()); }
/** @param plugin */ private void regDispatch(PluginRef ref) { Plugin plugin = ref.getPlugin(); Message am = plugin.getClass().getAnnotation(Message.class); if (am == null) { removeDispatchSource(ref); removeDispatchTarget(ref); return; } if (am.isSender()) { createDispatchSource(ref); } else { removeDispatchSource(ref); } if (am.isRecver()) { createDispatchTarget(ref); } else { removeDispatchTarget(ref); } }