[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] How to inject a static field into a multitude of types with AspectJ?
|
I hadn't forgotten you :)
I actually got something working related to your scenario although it
is a little fiddly.
If we consider the problem that getLogger() isn't returning the right
logger (because all it has to make the decision is 'this') then we can
cheat a little using a bit of around advice that can know more.
getLogger() can be an empty stub:
public Logger ILoggable.getLogger() {
return null;
}
and around advice can ensure it returns the right thing based on context:
Logger around(): call(* getLogger(..)) && !within(LoggerAspect) {
return getLoggerHolder(thisEnclosingJoinPointStaticPart).getLogger();
}
cheers,
Andy
On 12 January 2012 14:35, Mark <mark.kharitonov@xxxxxxxxx> wrote:
> Yo-Ho-Ho ...
>
> --
> View this message in context: http://aspectj.2085585.n4.nabble.com/How-to-inject-a-static-field-into-a-multitude-of-types-with-AspectJ-tp4168355p4290730.html
> Sent from the AspectJ - users mailing list archive at Nabble.com.
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users