This content has been marked as final.
Show 4 replies
-
1. Re: How to find methods that @Observes for specific events
diegocoronel Jan 29, 2012 10:19 AM (in response to gvagenas)its easy to find it with JBoss Tools...
-
2. Re: How to find methods that @Observes for specific events
gvagenas Jan 29, 2012 12:50 PM (in response to gvagenas)Any idea how to do it with out JBoss Tools ?
Thanks
-
3. Re: How to find methods that @Observes for specific events
milenkovic.m Feb 5, 2012 6:35 PM (in response to gvagenas)You may use method "resolveObserverMethods" provided by BeanManager.
let say that you have a method that observes for a SimpleEvent without any qualifiers (just to simplify a bit)
- inject the bean manager
- call manager.resolveObserverMethods ( new SimpleEvent() ) and it shall return a set of all methods that observe for a SimpleEvent
public class TestClass { @Inject BeanManager manager; public void resolveObservers(){ this.manager.resolveObserverMethods ( new SimpleEvent() ); }
}
public class HasAnObserver {
public void simpleObserver(@Observes SimpleEvent event){ }
}
if you need a qualifier you should specify it after the first parameter
-
4. Re: How to find methods that @Observes for specific events
gvagenas Feb 6, 2012 1:24 PM (in response to milenkovic.m)Thanks Marko.