Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Detect annotated method

Hi again,

First of all, you are welcome. Anyway, I have also made a mistake (I
have switched the methods names - m() and n())

The previous will match against the m() method and not the n() one,
right?
What I wanted to say is:
The previous will match against the n() method and not the m() one, right?

Thanks for clarifying what you really wanted :)

Still, have you tried the following? (it should work...)

Object around() : call(* *.*(..)) && !call(@MyAnnotation * *.*(..)) .... ?

Cheers,

Paulo Zenida

Quoting matsui akira <akira_in_tokyo@xxxxxxxxxxx>:

Sorry, I tryied to make things simpler but I just made it more
confusing. In the end, my words said one thing and my code said
another.

What I really wanted to do was to avoid having the aspect applied to
methods that are annotated by MyAnnotation. So that programmers could
specify which methods are exceptions regarding the application of the
aspect I'm creating.

But I did not wanted to explain all this to the mailing list users,
since it's a very specific detail about my project.

Anyway, thank you very much for your contribution. Now my code is
clean and functional.


From: Paulo Alexandre Corigo Zenida <paulo.zenida@xxxxxxxx>
To: matsui akira <akira_in_tokyo@xxxxxxxxxxx>
CC: AspectJ Mailling List <aspectj-users@xxxxxxxxxxx>
Subject: RE: [aspectj-users] Detect annotated method
Date: Tue, 21 Mar 2006 19:22:32 +0000

Quoting Wes Isberg <wes@xxxxxxxxxxxxxx>:

Hello,

Let me see if I understand this...

You want to capture this
@MyAnnotation public void m() { ... }

and not this
public void n() { ... }

then, why are you trying this
Object around(): call(* *.*(..)) && !call(* *.(@MyAnnotation *)(..)) or this
Object around(): call(* *.*(..)) && !@annotation(MyAnnotation) ?

The previous will match against the m() method and not the n() one,
right? Anyway, have you tried something like:

Object around() : call(* *.*(..)) && !call(@MyAnnotation * *.*(..)) .... ?

Best regards,

Paulo Zenida

Hi -

Glad you found a way to do it; sorry you had to do it the hard way!

AspectJ 5 features are discussed outside the programming guide
(which will be fixed soon at least with forward references):

 http://www.eclipse.org/aspectj/doc/released/adk15notebook/index.html

This section discusses signature patterns:

http://www.eclipse.org/aspectj/doc/released/adk15notebook/annotations-pointcuts-and-advice.html#signaturePatterns


It says that the annotation must be first in any modifier list.
(In Java annotations can be anywhere in the modifier list,
though they recommend the annotations come first as a matter of style.)

Wes

------------Original Message------------
From: "matsui akira" <akira_in_tokyo@xxxxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Date: Tue, Mar-21-2006 8:38 AM
Subject: RE: [aspectj-users] Detect annotated method

I just found a way to do it:

Object around(): call(* *.*(..)) && !@annotation(MyAnnotation) &&
etc....

sorry for this.

I was too stuck to the Programming Guide
(http://www.eclipse.org/aspectj/doc/released/progguide/index.html) and
could not find references to annotation style matching.

Anyway, is there any more comprehensive reference than the programming
guide?


>From: "matsui akira" <akira_in_tokyo@xxxxxxxxxxx>
>Reply-To: aspectj-users@xxxxxxxxxxx
>To: aspectj-users@xxxxxxxxxxx
>Subject: [aspectj-users] Detect annotated method
>Date: Wed, 22 Mar 2006 01:00:27 +0900
>
>Hello,
>
>I'm trying to write a pointcut that runs around every method that
>has a certain annotation. For example, I'm would like to run around
>code on this method:
>
>@MyAnnotation
>public void m( )
>{
>    // code....
>}
>
>but I don't wan to run around code on this other one:
>
>public void n( )
>{
>    // code....
>}
>
>I thought it was ok to do something like this:
>
>Object around(): call(* *.*(..)) && !call(* *.(@MyAnnotation *)(..))
>&& etc....
>
>But AJDT points that the code has syntax errors.
>
>What is the right way to acomplish what I want to do?
>Sure I can do this filtering by using some reflection. But I want
>programmers to see only aspect application marks only in calls in
>which aspects are really applied. So I'm pretty convinced that that
>should be a way to do it by writing correct pointcut code.
>
>Thanks in advance.

_________________________________________________________________
MSN繧キ繝ァ繝・ヴ繝ウ繧ー縺ァXbox360繧呈掠騾溘メ繧ァ繝・け・・
http://shopping.msn.co.jp/softcontent/softcontent.aspx?scmId=593

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


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




----------------------------------------------------------------
Mensagem enviada usando o IMP (Internet Messaging Program).



_________________________________________________________________
MSNショッピングでXbox360を早速チェック!
http://shopping.msn.co.jp/softcontent/softcontent.aspx?scmId=593





----------------------------------------------------------------
Mensagem enviada usando o IMP (Internet Messaging Program).




Back to the top