Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] writing around advice for an unknown method

Thank you Jean Louis, Mathew and Hemal for your answers.

Hemal, I just want to add that, apparently, one can write code like

Object result = proceed();
<code to execute after proceed>
return result;

and it would still work for methods that return void. That is what I
gathered from a brief test.

-Arvind


Hemal Pandya-2 wrote:
> 
>> For instance, the method might return
>> nothing (void) or primitive or an object. How do I write the 'proceed'
>> statement for this situation?
> 
> `return proceed()' works in all these cases, whether the advised method
> returns an object, a primitive, or nothing.
> 
> 
> On Fri, Mar 19, 2010 at 9:09 PM, Matthew Adams
> <matthew@xxxxxxxxxxxxxxx>wrote:
> 
>> Two things:
>>
>> 1. call(* *(..)) means upon the call to **every** method, not a random
>> one.
>>
>> 2. The sample advice is better written as the following.  (Jean
>> Louis's example would never execute <stuff after> due to the placement
>> of his return statement.)
>> Object around(): <my point cut>
>> {
>> <stuff before proceed>
>> Object returnValue = proceed();
>> <stuff after>
>> return returnValue;
>> }
>>
>>
>> On Fri, Mar 19, 2010 at 4:03 AM,  <jeanlouis.pasturel@xxxxxxxxxxxxxxxxxx>
>> wrote:
>> >
>> > Object around(): <my point cut>
>> > {
>> > <stuff before proceed>
>> > return proceed();
>> > <stuff after>
>> > }
>> >
>> > Cordialement / Best regards
>> >
>> >
>> >
>> > -----Message d'origine-----
>> > De : aspectj-users-bounces@xxxxxxxxxxx
>> > [mailto:aspectj-users-bounces@xxxxxxxxxxx] De la part de Ashank
>> > Envoyé : vendredi 19 mars 2010 11:56
>> > À : aspectj-users@xxxxxxxxxxx
>> > Objet : [aspectj-users] writing around advice for an unknown method
>> >
>> >
>> > Hello,
>> >
>> > I have an urgent 'newbie' question and could not get the info from the
>> docs
>> > and forums upon a brief search. I am confused about the around advice
>> and
>> > calling proceed from within.
>> >
>> > I want to write an 'around' advice for a random method call (e.g. the
>> > pointcut call(* *(..)). For such pointcuts, I don't know about the
>> matching
>> > method call and its return types. For instance, the method might return
>> > nothing (void) or primitive or an object. How do I write the 'proceed'
>> > statement for this situation?
>> >
>> > Thanks in advance,
>> > Arvind
>> > --
>> > View this message in context:
>> >
>> http://old.nabble.com/writing-around-advice-for-an-unknown-method-tp27950935
>> > p27950935.html
>> > Sent from the AspectJ - users mailing list archive at Nabble.com.
>> >
>> > _______________________________________________
>> > aspectj-users mailing list
>> > aspectj-users@xxxxxxxxxxx
>> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
>> >
>> >
>> >
>> > *********************************
>> > This message and any attachments (the "message") are confidential and
>> intended solely for the addressees.
>> > Any unauthorised use or dissemination is prohibited.
>> > Messages are susceptible to alteration.
>> > France Telecom Group shall not be liable for the message if altered,
>> changed or falsified.
>> > If you are not the intended addressee of this message, please cancel it
>> immediately and inform the sender.
>> > ********************************
>> >
>> > _______________________________________________
>> > aspectj-users mailing list
>> > aspectj-users@xxxxxxxxxxx
>> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
>> >
>>
>>
>>
>> --
>> mailto:matthew@xxxxxxxxxxxxxxx
>> skype:matthewadams12
>> yahoo:matthewadams
>> aol:matthewadams12
>> google-talk:matthewadams12@xxxxxxxxx<google-talk%3Amatthewadams12@xxxxxxxxx>
>> msn:matthew@xxxxxxxxxxxxxxx <msn%3Amatthew@xxxxxxxxxxxxxxx>
>> http://matthewadams.me
>> http://www.linkedin.com/in/matthewadams
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
> 

-- 
View this message in context: http://old.nabble.com/writing-around-advice-for-an-unknown-method-tp27950935p27977010.html
Sent from the AspectJ - users mailing list archive at Nabble.com.



Back to the top