1 / 6

CSE403 ● Software engineering ● sp12

CSE403 ● Software engineering ● sp12. Aspect-oriented design and programming  AspectJ. Join point. A join point is a well-defined point in the control flow of a program Immediately before (or after) a method execution starts (or finishes) O bject instantiations

Télécharger la présentation

CSE403 ● Software engineering ● sp12

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSE403 ● Software engineering ● sp12 Aspect-oriented design and programming AspectJ

  2. Join point • A join point is a well-defined point in the control flow of a program • Immediately before (or after) a method execution starts (or finishes) • Object instantiations • Constructor executions • Field references • Handler executions • Join points are execution-time notions – and each one is different even if it happens due to the exact same piece of source code in a program

  3. Pointcut • A pointcut defines – gives a name to – a set of join points • execution(void Point.setX(int)) • handler(ArrayOutOfBoundsException) • call(*.new(int, int)) • execution(public !static * *(..)) • pointcut setter(): target(Point) && (call(void setX(int)) || call(void setY(int))); • That is, pointcuts are a way to identify a subset of join points in a program execution – a cross-cutting set of join points

  4. advice • Join points exist • Pointcuts are defined • But nothing happens until some code is provided that is to execute when a join point that is part of a pointcut is reached during execution • That code is called advice • AspectJ has three kinds of advice • Before • After • Around

  5. Hello World • http://www.eclipse.org/ajdt/demos/HelloWorldAspectJ.html

  6. http://eclipse.org/aspectj/doc/released/progguide/starting-aspectj.htmlhttp://eclipse.org/aspectj/doc/released/progguide/starting-aspectj.html

More Related