Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] withincode question

Hello,

I have question on withincode. Consider this:

public class Invoker
{
  public Object invoke( MyObject myObject )
  {
// code omitted to transform myObject to a Method object and the needed
arguments

   return method.invoke( object, object[] );
}

I want to write a pointcut that matched with the method.invoke() call but
only within the invoke method of the Invoker class. I tried this, but
eclipse tells me that it does not match:

pointcut runAction():call( * Method.invoke(Object, Object[]) ) &&
withincode( * Invoker.invoke(*));
You probably want to do

pointcut runAction():call( * Method.invoke(Object, Object[]) ) && withincode( * Invoker.invoke(..));

and if the Classes are in packages other then the aspect you need to qualify the classes (perhaps import works too).

Best regards

Ben


Back to the top