I'm rolling my own IAuthorizationStrategy
for Wicket 1.5.x I've setup type annotation for pages to use with isInstantiationAuthorized()
. It works well and I'd like to use annotations for isActionAuthorized()
as well. Ideally I'd like to be able annotate local variables and then check the annotations in my AuthStrategy. From what I've read Local variable Annotation doesn't work that way.
Is there any kind of known work around, maybe some sort of Compile time annotation processing to turn an annotated local variable into an "anonymous" subclass with the annotation as a type annotation?
For the record, the annotation I'm trying to use looks like this:
@Retention(RetentionPolicy.Runtime)
@Target(ElementType.Type, ElementType.LOCAL_VARIABLE)
public @interface AdminOnly
{
int isVisible() default 0;
int isEnabled() default 1;
}
UPDATE
So based on @Xavi López'es answer what I was hoping to do isn't exactly possible. Annotated LocalVariables should be available at compile time though. Is there some way maybe I could use them as a shortcut for boiler-plating the meta-data code examples that are available in Wicket Examples or the excellent Apache Wicket Cookbook?