[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] staticinitialization and target class
|
Hi Mohammad,
staticinitialization has no target object because when a class is initialized there is no instance yet. Probably you can obtain the class and other informations using ThisJoinPointStaticPart inside your advice.
pointcut observerMethods():
staticinitialization(@Observer com..*);
after(): observerMethods() {
InitializerSignature initsig = (InitializerSignature)ThisJoinPointStaticPart.getSignature();
Class klass = initsig.getDeclaringType();
// adding 'klass' into Registry
}
See
http://www.eclipse.org/aspectj/doc/released/runtime-api/index.html for more info.
Simone
2010/4/27 Mohammad Norouzi
<mnrz57@xxxxxxxxx>
Hello
I want to register those classes annotated with @Observer in a Registry class... I want this occurs in a static block of such classes:
pointcut observerMethods(Class klass):
staticinitialization(@Observer com..*)
&& target(klass);
after(Class klass): observerMethods(klass) {
// adding 'klass' into Registry
}
but as I read in manual it is said staticinitialization has no target object... is this right? if yes, how can I obtain the Class of those classes. Can I declare a static-block for matching classes?
thanks
Regards,
Mohammad
--------------------------
Sun Certified Web Developer
Have a look at some pictures @ http://pixelshot.wordpress.com/
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users