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 <[email protected]> wrote:
> Hi Users,
>
> Go through the following steps once.
>
> 1) My Java class code
>
> public static void main(String[] args)throws IOException,SQLException
> {
> Vector *testvector* = new Vector();
> testvector.add("abc");
> }
>
>
> 2) Aspect Implementation
>
> 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"
> }
>
> 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: [email protected]
> 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
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users