[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Introduce static members into several classes at once?
|
This time it's not a compiler bug, but a plain old user question.
I'm currently investigating how useful AspectJ is in converting/extending a
legacy code basis. I'm trying to roll out new logging mechanisms with
minimal code changes, especially to avoid boiler-plate code.
What I want to do is to inject static members into a multitude of classes
selected by a type pattern. Basically I want to have a marker annotation
@MakeLoggable, and all types on which this annotation is declared should get
a private static member. I dream of something like this:
public @interface MakeLoggable {}
Public aspect AutoLogging {
Private static Logger (@MakeLoggable *).LOGGER /* = init code */;
}
This doesn't compile, it seems I can only declare the LOGGER member on one
type exactly, not on several at once. And I cannot find from the
documentation how I can express my wish in valid AspectJ code :-)
Is it possible at all, and if so, how?
Martin