Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Aspect-oriented programming
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===AspectJ's join-point model=== {{Main article|AspectJ}} {{unordered list | The join points in AspectJ include method or constructor call or execution, the initialization of a class or object, field read and write access, and exception handlers. They do not include loops, super calls, throws clauses, or multiple statements. | Pointcuts are specified by combinations of ''primitive pointcut designators'' (PCDs). "Kinded" PCDs match a particular kind of join point (e.g., method execution) and often take a Java-like signature as input. One such pointcut looks like this: <syntaxhighlight lang="aspectj"> execution(* set*(*)) </syntaxhighlight> This pointcut matches a method-execution join point, if the method name starts with "<code>set</code>" and there is exactly one argument of any type. "Dynamic" PCDs check runtime types and bind variables. For example, <syntaxhighlight lang="aspectj"> this(Point) </syntaxhighlight> This pointcut matches when the currently executing object is an instance of class <code>Point</code>. Note that the unqualified name of a class can be used via Java's normal type lookup. "Scope" PCDs limit the lexical scope of the join point. For example: <syntaxhighlight lang="aspectj"> within(com.company.*) </syntaxhighlight> This pointcut matches any join point in any type in the <code>com.company</code> package. The ''<code>*</code>'' is one form of the wildcards that can be used to match many things with one signature. Pointcuts can be composed and named for reuse. For example: <syntaxhighlight lang="aspectj"> pointcut set() : execution(* set*(*) ) && this(Point) && within(com.company.*); </syntaxhighlight> This pointcut matches a method-execution join point, if the method name starts with "<code>set</code>" and <code>this</code> is an instance of type <code>Point</code> in the <code>com.company</code> package. It can be referred to using the name "<code>set()</code>". | Advice specifies to run at (before, after, or around) a join point (specified with a pointcut) certain code (specified like code in a method). The AOP runtime invokes Advice automatically when the pointcut matches the join point. For example: <syntaxhighlight lang="aspectj"> after() : set() { Display.update(); } </syntaxhighlight> This effectively specifies: "if the ''<code>set()</code>'' pointcut matches the join point, run the code <code>Display.update()</code> after the join point completes."}}
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Aspect-oriented programming
(section)
Add topic