Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] How to "disable" aspect


Jesse,

This is much better and incurs little or no runtime overhead.

public aspect ManagerSecurity
{
   final boolean RUN = true;

   pointcut myPointcut(): if(RUN) && call(* com.test.*.*(..));

   before(): myPointcut() {
      // Do Stuff Here
   }
}


Matthew Webster
Tools UI Strategy
CICS Technical Planning & Strategy, MP189
IBM United Kingdom Limited
Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)



Jesse Hepburn <jesse_hepburn@xxxxxxxxx>
Sent by: aspectj-users-bounces@xxxxxxxxxxx

18/04/2007 18:20

Please respond to
aspectj-users@xxxxxxxxxxx

To
aspectj-users@xxxxxxxxxxx
cc
Subject
Re: [aspectj-users] How to "disable" aspect





This isn't the most elegant solution, but it works if you need to turn it on and off easily...

public aspect ManagerSecurity
{
   final boolean RUN = true;

   pointcut myPointcut(): call(* com.test.*.*(..));

   before(): myPointcut() {
      if(RUN)
      {
         // Do Stuff Here
      }
   }
}

----- Original Message ----
From: Josh <gemini929@xxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Sent: Wednesday, April 18, 2007 10:14:13 AM
Subject: Re: [aspectj-users] How to "disable" aspect

Jesse,
 
Can you give me an example?
 
Joshua


On 4/18/07, Jesse Hepburn <jesse_hepburn@xxxxxxxxx> wrote:
I would use a constant within the pointcut to determine if it should be run or not.

----- Original Message ----
From: Josh <
gemini929@xxxxxxxxx>
To: aspectj-users <
aspectj-users@xxxxxxxxxxx>
Sent: Wednesday, April 18, 2007 8:14:10 AM
Subject: [aspectj-users] How to "disable" aspect

I am a beginner with AspectJ.  I have assembled several aspects which are usefull to my project.  Some aspects, like the tracing aspect, I only use

occasionally.  Is there a way to "disable" an aspect in the source code instead of removing the entire aspect from your source directory?
 
-Joshua
_______________________________________________
aspectj-users mailing list

aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users




Ahhh...imagining that irresistible "new car" smell?
Check out
new cars at Yahoo! Autos.

_______________________________________________
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



Ahhh...imagining that irresistible "new car" smell?
Check out
new cars at Yahoo! Autos. _______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users







Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU







Back to the top