It started working for me too, the only thing i did is i changed before advice to after advice, then it started showing me the target object information.
Thanks,
Krishnachaitanya Jasty
Tata Consultancy Services
Mailto:
krishna.jasty@xxxxxxxWebsite:
http://www.tcs.com____________________________________________
Experience certainty. IT Services
Business Solutions
Consulting
____________________________________________
To: aspectj-users@xxxxxxxxxxx
From: Andy Clement
Sent by: aspectj-users-bounces@xxxxxxxxxxx
Date: 06/28/2013 03:01AM
Subject: Re: [aspectj-users] aspectj capturing currently executing object
This works for me:
aspect Aspect {
pointcut allConstructors() : call( * java.util..add(..));
Object around() : allConstructors() {
Object[] objarr = thisJoinPoint.getArgs();
for (int i = 0; i < objarr.length; i++) {
System.out.println("object is..."+objarr[i]);//This will give me tha value "abc"
}
System.out.println(((Vector)thisJoinPoint.getTarget()).size());
Object x = proceed();
System.out.println(((Vector)thisJoinPoint.getTarget()).size());
return null;
}
}
it prints 0 and 1 for the size of the target vector. Is that how you were using getTarget()?
Andy