You're right that you have to enumerate -- first, second.. last: (execution(* *(Order, ..)) && args(order, ..)) || (execution(* *(*, Order, ..)) && args(*, order, ..)) || (execution(* *(*, *, Order, ..)) && args(*, *, order, ..)) ... for as many places as you need, then || (execution(* *(.., Order)) && args(.., order))
Wes > ------------Original Message------------ > From: Martin Börlin <[EMAIL PROTECTED]> > To: [email protected] > Date: Mon, Sep-18-2006 3:58 AM > Subject: [aspectj-users] pointcut to match a specific object in argument > > All! > > How do I create a pointcut that matches the joinpoint where a method > is executed and has (at least) one specific argument, regardless of > other arguments (their number and place) in the method. I.e. I want a > pointcut that matches the execution of all methods with one argument > Order. See some example methods at the end of this email. > > My futile atemts to write this pointcut looks like this: > > //seems to only match methods where the Order object argument is last, > example 3), 4) and 5) > pointcut trackOrder(Order order) : > execution(* *(.., Order, ..)) > && (args(.., order)); > > //seems to only match methods where the Order object argument is > first, example 1), 4) and 5) > pointcut trackOrder(Order order) : > execution(* *(.., Order, ..)) > && (args(order, ..)); > > //"Could" work but generates the error: "2 uses more than one .. in > args (compiler limitation)" > pointcut trackOrder(Order order) : > execution(* *(.., Order, ..)) > && (args(.., order, ..)); > > > 1) public void m1(Order myOrder, String s1, String s2) > > 2) public String m2(String s1, Order myOrder, int i1) > > 3) public boolean myMethod(int i1, String s1, Order myOrder) > > 4) public Order getOrderId(Order order) > > 5) public int compare(Order o1, Order o2) > > > Regards Martin Börlin > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users > _______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
