Closed GoogleCodeExporter closed 9 years ago
Sorry I realize what I wanted to do would not work in java anyhow. Still forget
Java generics not like c# generics.
public class A implements EventHandler<BEvent>, EventHandler<CEvent>
{
public void handleEvent(BEvent event) {
// do stuff
}
public void handleEvent(CEvent event) {
// do stuff
}
}
Original comment by simon.pe...@simaptech.com
on 22 Nov 2012 at 9:22
Hi Simon,
Are you using the latest version of Guava (13.0.1)? Unless I'm misunderstanding
your request version 13.0.1 _does_ consider interface-level annotations
(meaning that they're inherited). I have some code that relies on this,
actually.
If you _are_ using 13.0.1, perhaps the use of a generic type parameter has
something to do with it. Didn't test that.
Original comment by stephan...@gmail.com
on 22 Nov 2012 at 9:25
Ah, our comments crossed :) So you verified that in absence of generics the
interface-level annotation _is_ respected?
Original comment by stephan...@gmail.com
on 22 Nov 2012 at 9:26
Hi,
I stumbled across this discussion while I was investigating how
eventBus.register() would work for classes that are Spring proxies.
I am finding that the AnnotationHandlerFinder will not work for a class (that
is registered with the eventBus) for which Spring has created a dynamic proxy
because the annotations (@Subscribe in this case) will not be available on the
proxy.
So I decided to write my own custom impl of HandlerFinder but then I discovered
that there is no way to set the finder on the EventBus.... bummer!
Is there a suggestion on how I can tell the eventBus to use a different
strategy short of extending the EventBus class itself?
Thanks!
Original comment by pankajta...@gmail.com
on 7 Dec 2012 at 7:19
Gaaaah! HandlerFindingStrategy is a private interface!
Any suggestions for this problem?
To rephrase: How can I @Subscribe beans that are registered as a JDK Dynamic
proxy?
Thanks!
Original comment by pankajta...@gmail.com
on 7 Dec 2012 at 7:43
Possibility: write a new wrapper class to put around the proxies that provides
a
@Subscribe
public void passEventToProxy(Object event)
and then implement whatever reflective mojo you need in that wrapper class.
Then just use EventBus.register(new ProxyWrapper(proxy)).
Original comment by lowas...@google.com
on 7 Dec 2012 at 9:11
I guess I was hoping to make my original class implement a custom interface
(called Subscribe, say) and since interfaces are available on the proxy, use a
custom implementation of the handler finder look for proxies with that
interface on it.
But, I've got around this issue for now by registering the original
(pre-proxied) bean. But making that HandlerFindingStrategy interface public for
future extensions would greatly help!
Thanks!
Original comment by pankajta...@gmail.com
on 9 Dec 2012 at 9:22
Original comment by wasserman.louis
on 22 Jul 2013 at 3:27
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:13
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:08
Original issue reported on code.google.com by
simon.pe...@simaptech.com
on 22 Nov 2012 at 8:32