[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
[aspectj-users] Around advice and return type
|
- From: Adam Smyczek <adamsmyczek@xxxxxxxxx>
- Date: Tue, 17 Oct 2006 11:13:35 -0700
- Delivered-to: aspectj-users@eclipse.org
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer; b=qSYuS8ds1LXLu1S+7M8vjzlSrqUFBV3rGU+BEh2xgR8l4G0FXXfuNhQ3RNlS2rrhKZ3Jk5aP6XivHrl2zQTz/l4wHh8Ugisfh2/IohdsytUZhpz2GLYakMnWhsDR63IDWbVqbRzULHco7azZQyzWU+mIJpf2pzJxleJlNRq06SM=
Hi all,
This is probably a beginner question.
In the following code snippet I would like to
catch all calls to methods that return an instance of class A
and all derived classes, do some operations on the object
and return it back.
@Pointcut("call(A+ *.*(..))")
void matchGetA() {};
@Around("matchGetA()")
public A processA(ProceedingJoinPoint thisJoinPoint) {
try {
A result = (A)thisJoinPoint.proceed();
...
return result;
} catch (Throwable e) {
throw new Exception(e);
}
}
This snippet does not compile when I have a method
public B getB() {}
and B is derived from A.
The only option I can think of is to set the return type of processA
() advice to Object.
Does a better (more type save) method exist to build this kind of
advices.
Thanks,
Adam