Pointcut
In aspect-oriented programming, a pointcut is a set of join points. A pointcut specifies where exactly to apply an advice, which allows separation of concerns and helps in modularizing business logic. Pointcuts are often specified using class names or method names, in some cases using regular expressions that match class or method names. Different frameworks support different Pointcut expressions; AspectJ syntax is considered as de facto standard. Frameworks are available for various programming languages like Java, Perl, Ruby, and many more which support pointcuts .
In aspect-oriented programming, a pointcut is a set of join points. A pointcut specifies where exactly to apply an advice, which allows separation of concerns and helps in modularizing business logic. Pointcuts are often specified using class names or method names, in some cases using regular expressions that match class or method names. Different frameworks support different Pointcut expressions; AspectJ syntax is considered as de facto standard. Frameworks are available for various programming languages like Java, Perl, Ruby, and many more which support pointcuts . ==Execution== Whenever the program execution reaches one of the join points described in the pointcut, a piece of code associated with the pointcut (called advice) is executed. This allows a programmer to describe where and when additional code should be executed in addition to already-defined behavior. Pointcut permits the addition of aspects to existing software, as well as the design of software with a clear separation of concerns, wherein the programmer weaves (merges) different aspects into a complete application. execution(void User.setPassword(password)) This pointcut matches execution of the User.setPassword method. call(void User.getPassword()) When User.getPassword is called, this pointcut is matched. handler(ArrayIndexOutOfBounds) Pointcut will match when there is an ArrayIndexOutOfBounds exception this(UserType) Pointcut will match when the object currently executing is of UserType. target(UserType) Pointcut will match when the target object is of UserType. within(UserType) Pointcut will match when the code executing belongs to UserType. ==References== ==External links== Paper "Back to the Future: Pointcuts as Predicates over Traces" by Karl Klose and Klaus Ostermann Paper "Remote Pointcut - A Language Construct for Distributed AOP" by Muga Nishizawa, Shigeru Chiba and Michiaki Tatsubori Paper "Datalog as a Pointcut Language in Aspect-Oriented Programming" Paper "Expressiveness and Complexity of Crosscut Languages" by Karl J. Lieberherr, Jeffrey Palm and Ravi Sundaram
References
- ^ "A Classification of Pointcut Language Constructs" (PDF) . Retrieved 29 December 2019 . Wikipedia revision 1376416966, retrieved 2026-11-20 · 1795129200.0
- ^ "Introduction to AspectJ" . Retrieved 14 September 2016 . Wikipedia revision 1376416966, retrieved 2026-11-20 · 1795129200.0
- ^ "JBoss AOP - User Guide" . docs.jboss.org . Retrieved 2016-09-14 . Wikipedia revision 1376416966, retrieved 2026-11-20 · 1473807600.0
- ^ "Join Points and Pointcuts" . Retrieved 14 September 2016 . Wikipedia revision 1376416966, retrieved 2026-11-20 · 1795129200.0
- ^ a b Tourwé, Tom; Kellens, Andy; Vanderperren, Wim; Vannieuwenhuyse, Frederik (2004). "Inductively generated PointCuts to support refactoring to Aspects" (PDF) . Wikipedia revision 1376416966, retrieved 2026-11-20 · 1795129200.0
- A Classification of Pointcut Language Constructs . · 1790118000.0
- Introduction to AspectJ . retrieved 14 September 2016 · 1790118000.0
- JBoss AOP - User Guide . docs.jboss.org . retrieved 2016-09-14 · 1473807600.0
- Join Points and Pointcuts . retrieved 14 September 2016 · 1790118000.0
- Inductively generated PointCuts to support refactoring to Aspects . · 1790118000.0
Cite this
"Pointcut". 1790206505. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1376416966 JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy