Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Find out who invoked a PointCut

Hello,

If I understood your question, you can use "this" to determine the instance that has called the method (it will be null for static calls). Example:

before(Object object) :  call(* *.*(..)) &&
 this(object) {
   System.out.println("Caller: " + object);
}

To determine the "context" where the method has been closed, you can also use "thisEnclosingJoinPointStaticPart". Example:

before(Object object) :  call(* *.*(..)) &&
 this(object) {
System.out.println("Enclosing context: " + thisEnclosingJoinPointStaticPart);
}

Hope this helps. Kind regards,

Paulo Zenida


Citando Moritz Post <moritzpost@xxxxxx>:

Hallo folks

I am wondering, whether aspectj is able to determine who invoked a method,
which got picked up by a PointCut. I have been doing some research but
didn't find a proper answer. Any help would be greatly appretiated.


Greets
Moritz Post

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




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




Back to the top