Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Intercepting array index using field get/set

Hi,
 I am wondering if it is possible to intercept an array index, i.e., 
similar to []operator overloading. I have been trying to do something like
  public pointcut captureGet(Object caller) : get(* MyClass.*) && 
this(caller); // possibly add if(Array) to the condition
  public pointcut captureSet(Object caller) : set(* MyClass.*) && 
this(caller); // possibly add if(Array) to the condition

  Object around(Object caller) : captureGet(caller) {
    // find my own object based on the index and 
return, e.g. 
    return proceed(myownindex);
  }
  void around(Object caller) : captureSet(caller) {

    proceed(myown-index);
  }


-- 
Regards,
Shahzad Bhatti



Back to the top