Skip to main content

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

Hi, Rob.

Usually such questions should go to the aspectj-users list. But to
answer your question: Can't you just solve this with this/target/args?

Eric



On 03/11/2007, Rob Austin <austirob@xxxxxxxxxxxxxx> wrote:
> 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());
>
>     }
> }
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>
>


-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada


Back to the top