Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] How do I write this aspect.

Thanks a lot for such a quick response to Ramnivas, and thanks a lot to
the folks at AspectJ in general, for providing such a powerful tool.
With this I am now able to instrument thirdparty jars to fix bugs in
them for a workaround while I await a patch from their support.

cheers,
pdhoolia

-----Original Message-----
From: aspectj-users-admin@xxxxxxxxxxx
[mailto:aspectj-users-admin@xxxxxxxxxxx] On Behalf Of Ramnivas Laddad
Sent: Friday, February 13, 2004 1:29 PM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] How do I write this aspect.


Try this:

Long around(String param) : call(Long.new(String)) 
                            && withincode(RType X.foo(..))
                            && arg(param) {
    return proceed(<your-string-here>);
}

-Ramnivas

Ramnivas Laddad, 
Author, AspectJ in Action 
http://www.manning.com/laddad
http://www.amazon.com/exec/obidos/ASIN/1930110936

Check out my aspect-oriented refactoring articles:
http://tinyurl.com/yqm96 http://tinyurl.com/288nn

--- Pankaj Dhoolia <pankaj.dhoolia@xxxxxxxxxxxxx> wrote:
> Folks,
>  
> I have the following situation.
>  
> Class X {
>     ...
>     Rtype foo(int i, int j) {
>         switch (..) {
>         ...
>         case ..:
>             ...
>             new Long(bar(..));
>             ...
>             break;
>         case ..:
>             ...
>             new Double(bar(..));
>             ...
>         ...
>         }
>         ...
>     }
>     ...
>     String bar(..) {
>         ...
>     }
>     ...
> }
>  
> I want to write an advice such that if a new Long(String) is performed
> in X.foo() then I want to replace that String with a String processed
> by
> my advice. I am having trouble writing it.
>  
> cheers,
> pdhoolia
> 


__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top