It goes with the aspect declaration:
public aspect Foo pertypewithin(...mypackage.*) { // All the types in "mypackage". ...
}
Here's the manual page for it, which is not as easy to get to with a google search as you would think (aspectj list traffic comes up first...)
Here's a very long message on the aspectj-dev list that shows an example:
Also, I couldn't remember if pertypewithin actually works with JDK 1.4, but apparently it does: http://dev.eclipse.org/mhonarc/lists/aspectj-users/msg03995.html
Can you give us some more details about what you're trying to do?
Hope this helps! dean
On Jan 31, 2008, at 2:10 AM, Andreas Mandel wrote: Hello,
I'm quite new to AspectJ so please apologize that some terms might not fully hit the target.
I tried hard to find the 'pertypewithin' keyword which allows me to do exactly what I wanted. (Guess what - debug logging and tracing). I'm working with a 1.4 JDK. Inspecting the generated code there is one thing that makes me unhappy because it is not as good as it could be:
To access the DeclaringType's aspect instance in the advice I need to call aspectOf(thisJoinPointStaticPart.getSignature().getDeclaringType()). This generates code that calls the static aspectOf(Class) method of the aspect to look up the DeclaringType's aspect instance via reflection. This simply returns a pointer back to the member that is already statically accessible in the DeclaringType (ajc$<...>$ptwAspectInstance). This could be directly accessible even in the static arrear (if(...)) allowing some major improvements - but unfortunately it not exposed to the advice.
Am I just missing an other key word to get direct access? Or is this a feature that needs to be coded?
If needed I can give more details.
Thanks for any feedback,
Andreas.
_______________________________________________ aspectj-users mailing list aspectj-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/aspectj-users
Dean Wampler, Ph.D. dean at objectmentor.com http://www.objectmentor.com See also: http://www.aspectprogramming.com AOP advocacy site http://aquarium.rubyforge.org AOP for Ruby http://www.contract4j.org Design by Contract for Java5
|