Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Matching methods with a particular argument type

Hi again,
 
We're getting this to work:
 

pointcut bcMethodsTransactionAfterMethods(Transaction tx):
  
(execution (!private * com.ericsson.nms.cif.cs.*.*(.., Transaction)) && args(.., tx) );

 

before(Transaction tx): bcMethodsTransactionBeforeMethods(tx) {
   CsTrace.traceTransaction(
      thisJoinPointStaticPart.getSignature().getDeclaringTypeName(),
      thisJoinPointStaticPart.getSignature().getName(),
      thisJoinPoint.getArgs(),
      tx);
}

 
But it doesn't seem to work when the Transaction object is null? Is that expected?
 
/David
 


From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Vincenz Braun
Sent: 07 February 2007 14:50
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Matching methods with a particular argument type

One can use .. in the front and the back in method patterns (more than once).
But you get a compilation error when using more than one .. in
args pointcut designators. This is a compiler limitation because of ambiguousness
in the binding.

And a 
before(): execution(* *.*(.., String, ..)) {


}
public class SignatureTest {

public void test(String arg) {


}
}

will match the SignatureTest.test(String).

And a 
before(String arg): execution(* *.*(.., String, ..)) && args(.., args, ...) {

will cause a compilation error: uses more than one .. in args (compiler limitation)

Am 07.02.2007 um 15:20 schrieb Eric Bodden:

No, I think think this is even syntactically wrong cause you cannot
have ".." both in the front and back. IMHO there is no way to match on
methods which have a String parameter at an arbitrary place (without
using reflection at least).

Eric

On 2/7/07, Marco Mistroni <mmistroni@xxxxxxxxx> wrote:
Hi,



Would the last case match:

   com.ericsson.nms.cif.cs.Aclass.Amethod(String something); ???


my 2 cents here.
Not in my opinion...
It will match any methods which have 3 parameters  in which the second one is a String.....

anyone could correct me if i m wrong?

regards
 marco



Regards,
David


_______________________________________________
aspectj-users mailing list





_______________________________________________
aspectj-users mailing list




-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada
_______________________________________________
aspectj-users mailing list

-- 

vincenz braun
evelox Consulting GmbH & Co. KG

email:  vb@xxxxxxxxx
phone: +49 700 VINCEBRAUN
mobile: +49 179 2190118



Back to the top