Simple Language Description
All valid Java programs are also valid AspectJ programs, but AspectJ also allows programmers to define special constructs called aspects. Aspects can contain several entities unavailable to standard classes. These are:
- inter-type declarations—allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an
acceptVisitor(see visitor pattern) method to thePointclass:
- pointcuts — allow a programmer to specify join points (well-defined moments in the execution of a program, like method call, object instantiation, or variable access). All pointcuts are expressions (quantifications) that determine whether a given join point matches. For example, this point-cut matches the execution of any instance method in an object of type
Pointwhose name begins withset:
- advice — allows a programmer to specify code to run at a join point matched by a pointcut. The actions can be performed before, after, or around the specified join point. Here, the advice refreshes the display every time something on
Pointis set, using the pointcut declared above:
AspectJ also supports limited forms of pointcut-based static checking and aspect reuse (by inheritance). See the AspectJ Programming Guide for a more detailed description of the language.
Read more about this topic: AspectJ
Famous quotes containing the words simple, language and/or description:
“And would you be a poet
Before youve been to school?
Ah, well! I hardly thought you
So absolute a fool.
First learn to be spasmodic
A very simple rule.
For first you write a sentence,
And then you chop it small;
Then mix the bits, and sort them out
Just as they chance to fall:
The order of the phrases makes
No difference at all.”
—Lewis Carroll [Charles Lutwidge Dodgson] (18321898)
“These are our grievances which we have thus laid before his majesty with that freedom of language and sentiment which becomes a free people, claiming their rights as derived from the laws of nature, and not as the gift of their chief magistrate.”
—Thomas Jefferson (17431826)
“As they are not seen on their way down the streams, it is thought by fishermen that they never return, but waste away and die, clinging to rocks and stumps of trees for an indefinite period; a tragic feature in the scenery of the river bottoms worthy to be remembered with Shakespeares description of the sea-floor.”
—Henry David Thoreau (18171862)