You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Adam Zimowski <zi...@gmail.com> on 2008/04/29 12:47:56 UTC
T5: Obtain custom annotation from page class
I'm annotating page classes with my own annotations, but when I
retrieve page from the cache the page does not carry my annotation.
This is understandable because T5 creates them on its own (javassist
magic, etc) but if I need Annotation instance, not the String value
from ComponentModel.getMeta() how could I get it without doing
Class.forName() ?
-adam
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Obtain custom annotation from page class
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Hi,
I use this:
Component page = componentSource.getPage(pageName);
Secured secured = page.getClass().getAnnotation(Secured.class);
Secured is my own annotation. It works just fine. Remember to put
@Retention(RetentionPolicy.RUNTIME) on your annotation.
-Filip
Adam Zimowski skrev:
> I'm annotating page classes with my own annotations, but when I
> retrieve page from the cache the page does not carry my annotation.
> This is understandable because T5 creates them on its own (javassist
> magic, etc) but if I need Annotation instance, not the String value
> from ComponentModel.getMeta() how could I get it without doing
> Class.forName() ?
>
> -adam
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org