[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Is this possible with Aspect/J?
|
Hi,
I have a SOAP interface where one method, login(), generates a cookie
which all other methods have to send as the first parameter. So all
the other methods look like:
public AttributeArrayResult getExtendedTransactionStatus(String key,
long transactionId) {
Account account = AuthenticationHelper.getInstance
().getAccountByKey (key);
if (account == null) {
logFailedLogin();
return new AttributeArrayResult("invalid key");
}
// ... do actual work
}
Clearly, the authentication check is an aspect that screams to be
refactored away. However, the various methods have different
signatures with different numbers of arguments, and I haven't been
able to find how to write around advice that handles this. Is this
possible at all?
(in Smalltalk, I'd just do
self authenticatedWith: key do: [
// ... do actual work
]
but using the whole anonymous inner class mess in Java just to pass a
bit of code actually makes it less readable)