[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [aspectj-users] passing an extra parameter to existing method s
|
Title: passing an extra parameter to existing methods
I think what I want is a pattern-based form of method introduction ...
unless there is another approach that would provide this same
thing.
Is there a way I could do the following with AspectJ?
I want to add methods to several classes that wrap existing
methods and add an additional parameter.
Then I want
to use around advice to make calls to the original methods go to the new
methods and add the new parameter.
For example, the deposit method in my Account class looks like
this.
public void deposit(double amount) {
balance += amount;
}
I want to add the following.
public void deposit(Context context, double amount) {
deposit(amount);
// Do something with the context parameter
here.
}
Then all calls to the original deposit method should go to the
new one.
I know how to do this for individual methods, but I'm looking
for a way to do this to many methods in the Account class without having to
write the code for each of them in my aspect.
***********************************************************************************
WARNING:
All e-mail sent to and from this address will be received or
otherwise
recorded by the A.G. Edwards corporate e-mail system and is
subject to
archival, monitoring or review by, and/or disclosure to,
someone other than
the
recipient.
************************************************************************************