Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] Help getting reference to an object

Hi,
 
I wonder if someone could give me some help.
 
I have an inner class PriceManager which resides in the class BookSellerAgent.
 
When it's method  PriceManager.setBuyerProposalDetail is called I need to capture the values passed in, which I do my getting a reference to the PriceManager object.
 
This is great, but what I also really need is a reference to the object in which PriceManager.setBuyerProposalDetail was called .
 
This is neccessary because if the values passed as arguments to setBuyerProposalDetail (Double,String) do not fall within a certain range I want to destroy the object which called the method.
 
I've provided a code snippet below. Thanks in advance for your help.
 
Cheers
 
Rob

public privileged aspect CaptureSetBuyerProposalPrice { 
  
 pointcut CaptureSetBuyerOffer( ):
       execution(void BookSellerAgent.PriceManager.setBuyerProposalDetail(Double,String));

 after(BookSellerAgent.PriceManager pManager) : CaptureSetBuyerOffer( ) && this(pManager)

    {

       System.out.println("Buyer Agent " +  pManager.getBuyerAgent()
  +  " made an offer of " +  pManager.getBuyerProposalPrice()); 
       
    }
}


Back to the top