Reading annotation values in runtime

2010-12-16 Thread Márcio Menezes
Hi,
I have to implement an authorization mechanism where I should be able to
define which fields in a view the user has access to: Read / Edit.
The idea that I had was to put annotations on top of those fields saying the
permission the user must have in order to interact with that field. To get
this, I would need to use some reflection when I am instantiating the view
to make it iterate through
all its annotated fields, check if the session user has that grant and apply
visible/enabled on that field.

Is it possible?? What would be the best solution to do this? Is there some
framework doing this already?

Ps: I took a look at some of them, like ACRIS, but it's pretty huge for what
I need. Besides, all the secured fields need to implement some interfaces
and all the fields need to be instantiated with GWT.create() - of course,
but would be much better if I could use this just on the view instantiation.

Regards, Marcio

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Reading annotation values in runtime

2010-12-16 Thread Myles Bostwick
There is no runtime reflection in GWT due to client code being compiled to 
javascript. What you could probably do is something with Generators and 
deferred binding. Create your view, then have a generator create a subclass 
that implements your security for all those annotated fields. Generators are 
my shiny new hammer right now though, so if someone has another idea...

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.