Query A local variable

View: New views
2 Messages — Rating Filter:   Alert me  

Query A local variable

by antofmr :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

Could anyone tell me if its possible using AspectJ to query a local variable. I have a local object created in a method and I would like to retrieve the value of one of its fields at the end of the method.

Thanks

Anthony

Re: Query A local variable

by Andrew Eisenberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Unfortunately, it is not possible to access local variables directly inside advice.  The best that you can do is use a "set" joinpoint to capture the initial setting of the variable.  Then you store this value inside of your aspect.  Finally, you can use after advice on the method to retrieve the value that you stored.

This is similar to the wormhole patterm:
http://www.theserverside.com/tt/articles/article.tss?l=AspectOrientedRefactoringPart2



Could anyone tell me if its possible using AspectJ to query a local
variable. I have a local object created in a method and I would like to
retrieve the value of one of its fields at the end of the method.


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