Skip to main content

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

Never mind my last question. IAJC correctly generated the corresponding
aspect class. The problem was that my next "compile" target was
regenerating my class folder.

I need to use my regular "compile" task, because my JRE has JMF
extensions. How can I force iajc task to use JMF libraries from my JRE?

Thanks.

Oleg

-----Original Message-----
From: aspectj-dev-bounces@xxxxxxxxxxx
[mailto:aspectj-dev-bounces@xxxxxxxxxxx] On Behalf Of Oleg Lebedev
Sent: Wednesday, July 27, 2005 1:36 PM
To: Alexandre Vasseur; AspectJ developer discussions
Subject: RE: [aspectj-dev] disabling aspects


Alexandre,

I tried using your approach, but I get a compiler error saying that
class A is not found when I try do A.aspectOf().toggle(). Is iajc Ant
task supposed to create this class for aspect A?

Thanks.

Oleg

-----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

_______________________________________________
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



Back to the top