[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
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