0

ZK, annotations and GUICE

asked 2014-03-25 09:50:32 +0800

ziccardi gravatar image ziccardi
321 7

Hi all.

I was using GUICE to add AOP code to my view controller when I encountered a problem: GUICE automatically generates a proxy object to inject my code and that made ZK unable to find my annotations (@command, @init, etc) anymore.

The problem is caused by the fact that the generated proxy object extends my class, so the annotation should be searched inside the super class.

The ZK BinderImpl class, however, looks for annotation only inside the current class, unless an annotation says that it should matter about superclass: however, as I wrote above, no annotations are found on the proxy object, so the superclass is never checked.

Wouldn't be better to provide a way to ask BinderImpl to check the super class for annotations?

I changed the AbstractAnnotatedMethodInvoker so that the code

curr = (annotation!=null && shouldLookupSuperclass(annotation))? curr.getSuperclass() : null;

became:

// always lookup super classes for annotations...

curr = curr.getSuperclass();

Moreover, I had to create a GuiceBindComposer to substitute the ZK BindComposer to be able to instantiate my ViewModel using GUICE instead of a simple 'newInstance' : wouldn't be better to give the users a chance to declare his own view model factory?

Thanks in advance,

Massimiliano

delete flag offensive retag edit
Be the first one to reply this discussion!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-03-25 09:50:32 +0800

Seen: 16 times

Last updated: Mar 25 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More