Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] around advice


Hi Rohith,

Your around advice doesn't seem to be using any of the set of AspectJ primitive pointcuts. Maybe redefining your around advice to use the execution and args pointcut designators as below will give you what you want ? This assumes that the method print() is defined in an aspect called "MyAspect"....


    void around(String prefix, Object message): execution(* MyAspect.print(String, Object)) && args(prefix, message) {
        System.out.println("regular proceed");
        proceed(prefix, message);
    }


Best regards,
George
________________________________________
George C. Harley




"Rohith Ajjampur" <ajjampur@xxxxxx>
Sent by: aspectj-users-admin@xxxxxxxxxxx

06/04/2004 14:29

Please respond to
aspectj-users

To
<aspectj-users@xxxxxxxxxxx>
cc
Subject
[aspectj-users] around advice





Hello all,

I have an aspect with a method named print() and an around advice which looks
like below:

   void around(String prefix, Object message): print(prefix, message) {
       System.out.println("regular proceed");
       proceed(prefix, message);
   }

   private void print(String prefix, Object message) {
       for (int i = 0, spaces = callDepth * 2; i < spaces; i++) {
           System.out.print(" ");
       }
       System.out.println(prefix + message);
   }

method print() gets called in the same aspect in after and before advices, after
i build this with ajbrowser i get an error that says: "can't find referenced
pointcut". Can anybody tell me where i'm going wrong.

Rohith.


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


Back to the top