Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] after advice - change returned value

My suggestion would be to use an around around advice, making your amendments to the value returned from proceed before in turn returning that value from the around advice. Assuming you are using a call(Signature) pointcut declaration, the after() returning advice executes *after* the join point and therefore after the return value of the method is set on the return of the call ... so it's not changeable at that point.

Cheers and hope this helps,

Russ

On 22 Feb 2005, at 22:25, Sebastian Berger wrote:

Hi,

I have the following method:
byte[] getData();

I wanna capture this method now with an after-advice. How can I get the value, which this method returns and change that value?

I know how to do this with arguments and an around-advice (using the proceed-advice) and I know how to capture the return value of a method:
void after() returning(byte[] data)

But how is it possible to change the returned value?
Should I use the after-advice(but how then?)? or should I use the around-advice together with the proceed-statement?

Thanks in advance
Sebastian

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top