Introduction

Aspect-oriented programming helps programmers in the separation of (cross-cutting) concerns to improve the overall architecture of an application by making it more modular and removing duplicate code.

Tuesday, May 4th, 2004 at 6:43 pm

AOP: Lexical-Structure Based Pointcuts

You can capture join points based on their lexical structure, that means on the scope of the code as it was written. There do exist two lexical-structure pointcuts: within(Type) and withincode(Method-/ConstructorSignature). I’ll explain how the function with the help of two examples:

within(MyClass+)
This would capture all join points inside the lexical scope of the class MyClass and all its subclasses.

withincode(* MyClass.myMethod(..))
This would capture all join points inside the lexical scope of any myMethod() method of the class MyClass.

I have used wildcards in the examples to make the explanation simpler. Refer to the article AOP: Wildcards if you do not understand what ‘*’, ‘+’ or ‘..’ mean.

You probably wonder why one would need lexical-scope based pointcuts. The answer is quite simple. When you capture calls to methods like System.out.println() that are probably also used within the aspect itself you must exclude this calls to avoid recursion.

Example:
call (* System.out.println(..)) && !within(MyAspect)
This pointcut will capture all calls to the System.out.println() method excluding the calls from within the aspect MyAspect.

I won’t write any more articles on pointcuts. But there do also exist pointcuts to capture the execution object and the arguments as well as conditional check pointcuts. I have found a comprehensive article on http://dev.eclipse.org called Pointcuts. Just refer to this article to learn about everything you have to know about pointcuts.

order generic viagra accutane online find cheap viagra buy generic soma price of clomid cialis online cheap viagra drug drug cialis buying generic viagra pharmacy cialis buy cheapest viagra purchase soma viagra cost order cialis viagra for sale buy cialis purchase synthroid online generic zithromax viagra overnight shipping cheapest viagra online cheapest zithromax cheap cialis tablet buy viagra from india acomplia prescription buy viagra no prescription required levitra pharmacy buying generic cialis buy zithromax without prescription lasix online viagra buy online zithromax without a prescription buy cialis from canada purchase viagra overnight delivery cialis for sale levitra online stores buy acomplia without prescription cheap generic levitra cheap propecia online cheap price viagra buy cheap viagra internet synthroid pharmacy viagra online cheap cialis uk cheap viagra from uk cheapest generic cialis online buy cialis in canada accutane pharmacy find cialis no prescription required order acomplia cheapest propecia price of acomplia buy generic cialis viagra in bangkok buy cheap propecia online buy lasix purchase levitra online find cheap viagra online buy discount viagra online clomid pharmacy clomid without a prescription buy generic acomplia soma prices cheapest soma buy zithromax lasix prescription viagra discount levitra without a prescription buy zithromax cheap acomplia pills cheap accutane cheap viagra overnight delivery soma buy viagra us