[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-dev] disabling aspects

Thanks Alexander, I will try this out.

-----Original Message-----
From: aspectj-dev-bounces@xxxxxxxxxxx
[mailto:aspectj-dev-bounces@xxxxxxxxxxx] On Behalf Of Alexandre Vasseur
Sent: Friday, July 22, 2005 2:49 AM
To: AspectJ developer discussions
Subject: Re: [aspectj-dev] disabling aspects


Hi

You can use an if pointcut and a boolean "isEnable" field in the aspect:
aspect A {
  boolean isEnable = false;
  toggle() {
    isEnable = !isEnable;
  }// write deploy / undeploy instead perhaps for clarity
  ... // advice / pointcut using if(isEnable)
}
Then you can use A.aspectOf().toggle() to turn it on and off.

You can use the very same patterns using @AspectJ syntax since if()
pointcut is supported there as well.

There has been a discussion at last AOSD about that. Perhaps someone has
the notes or a link to share.

Alex

On 7/22/05, Oleg Lebedev <oleglebedev@xxxxxxxxxxxxx> wrote:
>  
> Greetings.
>   
> Is there a way to disable aspects at runtime. Say, I know that an 
> aspect is weaved in somewhere in class MangledClass, which class 
> MyClass is going to instanciate. I don't want this aspect instructions

> to trigger when MyClass instanciates and then uses MangledClass.
>   
> Also, is there a way to access an aspect from a Java class and modify 
> it's public members?
>   
> Thanks.
>   
>  
> Oleg Lebedev
> Software Architect 
> Waterford Research Institute 
> Phone: 801.938.1724 
> Cell: 801.209.6706 
>   
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx 
> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
> 
> 
>
_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-dev

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
If you have questions about this email, please
contact the IT Help Desk.

Mail