[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Use aspectj to inject control flow
|
You can do the following (although, I suspect, your real question
is of more general nature, so this may not help you):
aspect ConitionalExecution {
pointcut inMethodABody() : withincode(String methodA());
Object around() : call(* method3()) || call(* method4()))
&& inMethodABody() {
if(conditionA) {
return proceed();
}
}
Object around() : call(* method5())
&& inMethodABody() {
if(!conditionA) {
return proceed();
}
}
}
-Ramnivas
--- Charles Zhang <czhang@xxxxxxxxxxxxxxxx> wrote:
> Hi, I want to write a piece of AspectJ code that adds new control
> flow to
> a sequence of execution such that code like the following:
> public String methodA()
> {
> method1();
> method2();
> method3();
> method4();
> method5();
> method6();
> }
> will behave like the following:
> public String methodA()
> {
> method1();
> method2();
> if(conditionA)
> {
> method3();
> method4();
> }else
> {
> method5();
> }
> method6();
> }
>
> I remember someone asked a similar question sometime ago. But I
> couldn't
> dig it out.
>
> Anyone has any suggestions? Thanks a lot.
>
> Charles Zhang (http://www.eecg.utoronto.ca/~czhang)
> Dept. of Elec. & Comp. Engineering
> U. of Toronto, Ontario, Canada
> *********************************************************
> " Yawn!!" (Charles Zhang)
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com