Pointcut on annotation attribute with any value?

View: New views
2 Messages — Rating Filter:   Alert me  

Pointcut on annotation attribute with any value?

by Kristof Jozsa :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

is it possible to use the within() pointcut and specify an annotation with some specific attribute but using any value?

I'm trying to implement some custom policy enforcement and I have not yet found a way to enforce setting eg. a @WebService annotation on classes with name, portName and serviceType attributes all set but using any value..

I tried to use this pointcut:
within (@WebService(name=*) *)

but appearently it matches on the name="*" attribute, not on a name attribute set with any value.

What'd be the correct syntax here?

thanks,
K

_______________________________________________
aspectj-users mailing list
aspectj-users@...
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Re: Pointcut on annotation attribute with any value?

by Andy Clement :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm afraid the use of wildcards in pointcut annotation values for
matching isn't supported right now.  You could raise an enhancement
but I doubt it will be implemented in the near term.  The best you can
do is write some advice to match on @WebService then inside the advice
look at the annotation value and do some pattern matching yourself.
But of course that is a runtime check, not a compile time check - so
possibly not what you want...

Andy

2009/9/7 Kristof Jozsa <kristof.jozsa@...>:

> Hi,
>
> is it possible to use the within() pointcut and specify an annotation with
> some specific attribute but using any value?
>
> I'm trying to implement some custom policy enforcement and I have not yet
> found a way to enforce setting eg. a @WebService annotation on classes with
> name, portName and serviceType attributes all set but using any value..
>
> I tried to use this pointcut:
> within (@WebService(name=*) *)
>
> but appearently it matches on the name="*" attribute, not on a name
> attribute set with any value.
>
> What'd be the correct syntax here?
>
> thanks,
> K
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@...
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_______________________________________________
aspectj-users mailing list
aspectj-users@...
https://dev.eclipse.org/mailman/listinfo/aspectj-users