Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Passing parameters

You can use:

 

pointcut notifyExecute(Event e) :
    call(StateTransition execute(..)) && args(e,...);

 

in that case. (assuming “e” is the first parameter)

 

Eric

 

From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Ed Lauder
Sent: Tuesday, October 17, 2006 12:01 PM
To: aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] Passing parameters

 

I tried that along with target(e).  The aspect compiles but does not get woven.

 

There are three params that get passed into the method execute().  Do all three need to be passed into the notifyExecute pointcut?

 


From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Eric Bodden
Sent: Monday, October 16, 2006 9:04 PM
To: aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] Passing parameters

 

Try something like…

 

pointcut notifyExecute(Event e) :
    call(StateTransition execute(..)) && args(e);

 

  after(Event event) returning : notifyExecute(event) {
    System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Call after Execute aspect");
    System.out.println("End Time in millis: " + System.currentTimeMillis());

    ystem.out.println(Event was: +event);
  }

 

 

Eric

 

From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Ed Lauder
Sent: Monday, October 16, 2006 4:43 PM
To: aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users] Passing parameters

 

I am trying to pass parameters from the point cut into the after advice.

 

My point cut gets the correct classes that I wish woven.  The problem is getting the values passed in to point cut into the advice.

 

Simply:

pointcut notifyExecute() :
    call(StateTransition execute(..));

 

  after() returning : notifyExecute() {
    System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Call after Execute aspect");
    System.out.println("End Time in millis: " + System.currentTimeMillis());
  }

 

There is an Event param that gets passed into the execute method and I would like to get access to the object within the after advice.

 

 


Back to the top