AspectJ Programming Help by Programmer`s hub
AspectJ Programming help
AspectJ is a Aspect oriented programming. AOP provide the benefits of modularity to the programs. In the simple Object-oriented programming languages the unit of modularity is className. In AspectJ aspect modularize affect more then one className. AspectJ can be used with J2EE components Servelets, JSP, EJB. The performance of the AspectJ depends on the JVM, faster the JVM, it will less time to compile the code
AspectJ Example Code
{` interface Shape { public void moveTo(int newx, int newy); public void rMoveTo(int deltax, int deltay); public void draw(); } `}
Spring AOP with AspectJ
- @Before; - Run before the method execution.
- @After; - Run after the method returned a result.
- @AfterReturning; - Run after the method returned a result.
- @AfterThrowing; - Run after the method throws an exception.
- @Around; - Run around the method execution.
AspectJ Technlogy Includes
- compiler (ajc)
- debugger (ajdb)
- documentation generator (ajdoc)
- program structure browser (ajbrowser)
- Integration with IDE's
- integration with Eclipse
- Sun-ONE/Netbeans
- GNU Emacs/XEmacs
- JBuilder, and Ant
Benefits of AspectJ
- It provides the system-wide error-handling
- contract enforcement
- distribution concerns
- feature variations
- context-sensitive behavior
- persistence
- testing