Thanks Andy,
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.ja...@tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty. IT Services
Business Solutions
Consulting
____________________________________________
-----aspectj-users-boun...@eclipse.org wrote: -----
To: aspectj-users@eclipse.org
From: Andy Clement
Sent by: aspectj-users-boun...@eclipse.org
Date: 06/28/2013 03:01AM
Subject: Re: [aspectj-users] aspectj capturing currently executing object
From: Andy Clement
Sent by: aspectj-users-boun...@eclipse.org
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
On 27 June 2013 03:11, Krishna Jasty <krishna.ja...@tcs.com> wrote:
Hi Users,
Go through the following steps once.1) My Java class codepublic static void main(String[] args)throws IOException,SQLException{
Vector testvector = new Vector();
testvector.add("abc");
}2) Aspect Implementationpointcut 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"
}Similarly if i want to get the object testvector and i want to perform the testvector.size() operation on it.
How to capture this testvector object, if i use this or getTarget() which is returning null.Please suggest the way to make it possible.Thanks,
Krishnachaitanya Jasty
Tata Consultancy Services
Mailto: krishna.ja...@tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty. IT Services
Business Solutions
Consulting
____________________________________________=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users
aspectj-users mailing list
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________ aspectj-users mailing list aspectj-users@eclipse.org https://dev.eclipse.org/mailman/listinfo/aspectj-users