Re: [aspectwerkz-user] Expression problem

Alexandru Popescu <[email protected]> Thu, 26 May 2005 20:19:22 +0200
Newsgroups gmane.comp.java.aspectwerkz.user
Message-ID <[email protected]>
#: on behalf of Simon Faress :: 5/26/2005 5:37 PM :#
> Hi,
> 
> I can advice the execution of every methods under the
> package com.myProject by using this expression :
> execution(* com.myProject..*.*(..))
> 
> But now, I would like to advice the execution of every
> methods under the package com.myProject excepted
> getter and setters. But I can't make it work.
> 
> My XML looks like this :
> 
> <!DOCTYPE aspectwerkz PUBLIC "-//AspectWerkz//DTD//EN"
> "http://aspectwerkz.codehaus.org/dtd/aspectwerkz.dtd">
> <aspectwerkz>
>     <system id="sequence">
>         <package
> name="com.myOtherProject.composant.aspect.sequence">
>             <aspect class="SequenceAspect">
>                 <pointcut name="sequence_pc"
> expression="execution(* com.myProject..*.*(..)) AND
> !withincode(* com.myProject..*.get*(..)) AND
> !withincode(* com.myProject..*.set*(..)) " />
> 				<advice name="beforeExecution" type="before"
> bind-to="sequence_pc" />
> 				<advice name="afterExecution" type="after"
> bind-to="sequence_pc" />
>             </aspect>
>         </package>
>     </system>
> </aspectwerkz>
> 
> What am I doing wrong ?
> 
> Any help would be muchly appreciated
> 
> 
> 	
> 
> 	
> 		
> _____________________________________________________________________________ 
> Découvrez le nouveau Yahoo! Mail : 1 Go d'espace de stockage pour vos mails, photos et vidéos ! 
> Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com
> 
This should work:

pointcut_all_methods: execution(* foo.bar..*.*(..))
pointcut_get_methods: execution(* foo.bar..*.get(..))
pointcut_set_methods: execution(* foo.bar..*.set(..))

your_pointcut pointcut_all_method && !pointcut_get_methods && !pointcut_set_methods

:alex |.::the_mindstorm::.|