[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Why annotations are not exposed through JoinPoint.StaticPart?
|
Interesting, I have not seen such usage before. But your blog does not
explain which scenarios are supported.
For instance, I have the following annotation:
==================================================
package com.shunra.poc.security;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ ElementType.METHOD, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface Authorize {
KnownRole[] allow();
}
==================================================
package com.shunra.poc.security;
import org.restlet.security.Role;
public enum KnownRole {
USER("user", "A limited user."), ADMINISTRATOR("admin", "The system
administrator."), GUEST("guest", "A guest user.");
public final Role Value;
private KnownRole(String name, String description) {
Value = new Role(name, description);
}
}
==================================================
So, how can I use it? The following pointcut does not compile:
==================================================
// Bind just the part of the annotation of interest:
pointcut colouredMethods(KnownRole role):
execution(public @Authorize * *(..)) &&
@annotation(Authorize(allow = { role }));
==================================================
It does not compile.
--
View this message in context: http://aspectj.2085585.n4.nabble.com/Why-annotations-are-not-exposed-through-JoinPoint-StaticPart-tp4196637p4201678.html
Sent from the AspectJ - users mailing list archive at Nabble.com.