[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] AspectJ inter-Class issue

Hi,
 
I am trying to refactor some code using AspectJ. Basically I have an interface "TransactionSubscriber" with an API "receive(Date, Transaction)". Now, there is another class PrevaylerImpl inside which the implementation of above is given as follows:
 
private TransactionSubscriber subscriber() {
  return new TransactionSubscriber() {
 
   public void receive(Transaction transaction, Date executionTime) {
    ...    
   }
  };
 }
I want to replace the function receive(Transaction, Date) by receive(Transaction) in the PrevaylerImpl class; and I want to move the function receive(Transaction, Date) into an aspect. So, the function receive(Transaction, Date) is only defined for TransactionSubscriber when the aspect is included.
 
This is how I have tried to refactor the code. First of all I changed the above code in PrevaylerImpl to be:
public class Subscriber implements TransactionSubscriber {
  public void receive(Transaction transaction) {
..   }
  }  
 }
 
 
 private TransactionSubscriber subscriber() {
  return new Subscriber();
 }
 
Next, I define in my aspect the following:
 
public void PrevaylerImpl.Subscriber.receive(Transaction transaction, Date executionTime) {
 }
 
The problem is that the above receive API uses some local variables of the PrevaylerImpl class. When I define the above API in my aspect, I keep getting an error that the specific field cannot be resolved. I am not sure what to do to see the PrevaylerImpl variable inside the PrevaylerImpl.Subscriber.receive API.
 
Can someone help please. I will appreciate your response.
thanks.
Sincerely,
Irum Godil.
 
 


Do you Yahoo!?
Yahoo! Search presents - Jib Jab's 'Second Term'