Advising advice

View: New views
2 Messages — Rating Filter:   Alert me  

Advising advice

by Sago Djuret :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is there a way to access the thisJoinPoint of an advice from a second advice?

The following pointcut successfully picks out interesting calls from other advice.


pointcut breachOfContract( boolean condition ):
                call( * require( boolean ))
                && args( condition );



How can I access the data of the original thisJoinPoint? Something like:

before( boolean condition ): breachOfContract( condition ) {
        System.out.println( thisJoinPoint.getThis().getSourceLocation() );
}




     

_______________________________________________
aspectj-users mailing list
aspectj-users@...
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Re: Advising advice

by Eric Bodden-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You have to store "thisJoinPoint" using the original advice (e.g. in a
field) or you hav eto make it the argument of a "dummy" method call
which will then be advised by the second advice.

Eric

2008/8/30 Sago Djuret <sagodjuret@...>:

> Is there a way to access the thisJoinPoint of an advice from a second advice?
>
> The following pointcut successfully picks out interesting calls from other advice.
>
>
> pointcut breachOfContract( boolean condition ):
>                call( * require( boolean ))
>                && args( condition );
>
>
>
> How can I access the data of the original thisJoinPoint? Something like:
>
> before( boolean condition ): breachOfContract( condition ) {
>        System.out.println( thisJoinPoint.getThis().getSourceLocation() );
> }
>
>
>
>
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@...
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>



--
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada
_______________________________________________
aspectj-users mailing list
aspectj-users@...
https://dev.eclipse.org/mailman/listinfo/aspectj-users
LightInTheBox - Buy quality products at wholesale price!