Enumeration would definitely be faster. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Martin Börlin Sent: Monday, September 18, 2006 11:34 PM To: [email protected] Subject: Ang: Re: [aspectj-users] pointcut to match a specific object inargument
Thanks Wes and Ron! I'm curious, which variant would be the fastest? The one where I actually bind the Order object but have to enumerate all possible method arguments, or the one where I only need one execution() statement but have to loop through the argument list in quest for my Order object? Regards -Martin >----Ursprungligt meddelande---- >Från: [EMAIL PROTECTED] >Datum: 2006-09-18 20:16:38 >Till: "AspectJ Mailing List"<[email protected]> >Kopia: "Martin Börlin"<[EMAIL PROTECTED]> >Ärende: Re: [aspectj-users] pointcut to match a specific object in argument > >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 _______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
