[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?
|
- From: Andy Clement <andrew.clement@xxxxxxxxx>
- Date: Sun, 18 Dec 2011 17:03:57 -0800
- Delivered-to: aspectj-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=VQIGFhYnES8c+T9GSGLPX8thEhzAeEecPKle7vgDic0=; b=FV3isCkjoSItgTXWTQ0HLKcELwDuP5q9CJhZX8Aee7NE+sXTPCRqw2kegeMA/dXUnD 6oCaUEnR1Sh1Zz7sYkBtVTS9Iqeid5sWCzHJb8Myb36rvWhO+IcbE/OFYOT+sqSvWRxw etYgbnipjy0bomxh+rTlSPRl5NsOjwsUTsPxs=
Hi,
As I mentioned at the end of the article, support for value variants
is added as compelling use cases come up. String/enum were originally
added, since then 'int' has been added. array has not been added and
that is what you are trying.
I've raised https://bugs.eclipse.org/bugs/show_bug.cgi?id=367042 to
cover the array case. It won't be as straightforward as the others
though, I presume you'd want to bind multiple entries in an array or
bind a specific entry and not others.
cheers,
Andy
On 15 December 2011 11:53, Mark <mark.kharitonov@xxxxxxxxx> wrote:
> 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.
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users