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 thePoint
class:
- 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
Point
whose 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
Point
is 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:
“Truth is used to vitalize a statement rather than devitalize it. Truth implies more than a simple statement of fact. I dont have any whisky, may be a fact but it is not a truth.”
—William Burroughs (b. 1914)
“They who in folly or mere greed
Enslaved religion, markets, laws,
Borrow our language now and bid
Us to speak up in freedoms cause.”
—Cecil Day Lewis (19041972)
“The next Augustan age will dawn on the other side of the Atlantic. There will, perhaps, be a Thucydides at Boston, a Xenophon at New York, and, in time, a Virgil at Mexico, and a Newton at Peru. At last, some curious traveller from Lima will visit England and give a description of the ruins of St Pauls, like the editions of Balbec and Palmyra.”
—Horace Walpole (17171797)