Hi,

I would like to return a boolean value form the handler instead of using the value of the boolean itself to control the bubbling process (actually the same applies to void). For this purpose, I defined an annotation to prevent events to bubble for the annotated event handler methods, and a ComponentClassTransformationWorker.

The first idea was to let the worker to modify the return value of the original method to something wrapping the boolean (and the void) and override its result. Unfortunately I did not find a way to do that. The next idea is to add a new eventHandler method that listen for the same events/components of the original one, it basically wraps the body of the original method using an advide. The problem now is to "register" this new method with the dispatcherMethod. I think the best way is to annotate the method with the OnEvent annotation and name it something like:

_+originalMethod name

In this way, this method should be always called before the original one, always produces an Object that stops the bubbling, and always invoke the same logic as the original method.

The problem: I cannot find a way to add the annotation to a generated method.


In another possibility, I can name the new method with something like on+MethodName. But, I do not remember if the annotation takes precedence over the naming convention. Anyway, this solution is not so clean (and there may be clashes or method duplications).

Any advice ?

BTW, I am using 5.2

Thank you.

-- Alessio

PS: As far as possible, I would like the OnEventWorker to register handler methods in the component event dispatcher.


Reply via email to