Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » around advice question
around advice question [message #591962] Tue, 24 January 2006 16:40
Asaf is currently offline AsafFriend
Messages: 36
Registered: July 2009
Member
Hi,



I'm testing the usage of Aspectj and encountered a problem.



I wrote the following code:



public aspect myAspect{



pointcut publicMethods() : execution(public * myMain.func(..));



pointcut logObjectCalls() : execution(* Logger.*(..));



pointcut loggableCalls() : publicMethods(); //l&& ! logObjectCalls();



before() : loggableCalls(){

Logger.entry(thisJoinPoint.getSignature().toString());

}



after() : loggableCalls(){

Logger.exit(thisJoinPoint.getSignature().toString());

}



void around(): call(public void myMain.func(String)){

if(Math.random() > .5){

System.out.println("> 0.5");

proceed(); //go ahead with the method call

}

else{

System.out.println("< 0.5");

}

}



}



The function FUNC of MYMAIN class has only one argument which is of String
type.

What I would like to achieve is that I will be able to check the input
parameters in the AROUND advice.



Thanks in advance,



Asaf Lahav
Previous Topic:Can ajdt works with product's export?
Next Topic:pointcut all method calls on an object that implements an interface
Goto Forum:
  


Current Time: Tue Sep 24 16:19:52 GMT 2024

Powered by FUDForum. Page generated in 0.03268 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top