[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Question about matching JoinPoints

Ok, what I mean is that, for example, I have some pointcuts and advices in an aspect, but also I have a method that receives a JoinPoint object. I need to declare a new Pointcut with that JoinPoint object, inside the method, so an advice can catch it. Its something like this:

public aspect a1
{
pointcut p1(): call(* Class.method(*));
before(): p1()
{
System.out.println("Inside the advice");
method(thisJoinPoint);
}

public static void method(JoinPoint join)
{
//Evaluate it or match it, so advice can catch it again
}
}

Thank you,



On Sat, Nov 12, 2011 at 12:01 PM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
Hi,

Not quite sure what you want to achieve here, maybe share some
pseudocode that shows your intention?

Once you have the joinpoint object it isn't used for matching a second
time.  If you want to advise advice, you use a pointcut that matches
it, like adviceexecution().

If you want to 'call' some advice in a more direct way rather than
rely on implicit invocation, perhaps you could use annotation style
aspects and then call the advice directly passing everything it needs.
 (since the advice methods are not 'anonymous' like they are in code
style aspects).

Andy

On 11 November 2011 07:42, Andres Barrera <andres397@xxxxxxxxx> wrote:
> Hello, I got a question, I have a JoinPoint instance (for example, the one
> that you get when you use thisJoinPoint keyword), I´m receiving it from
> another aspect, and I need to match it in the receiving aspect, so an advice
> can intercept it. How can I do that?
> Thank you,
>
> --
> Andrés Barrera
>
> _______________________________________________
> 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



--
Andrés Barrera