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:
“A simple child,
That lightly draws its breath,
And feels its life in every limb,
What should it know of death?”
—William Wordsworth (17701850)
“Never resist a sentence you like, in which language takes its own pleasure and in which, after having abused it for so long, you are stupefied by its innocence.”
—Jean Baudrillard (b. 1929)
“The great object in life is Sensationto feel that we exist, even though in pain; it is this craving void which drives us to gaming, to battle, to travel, to intemperate but keenly felt pursuits of every description whose principal attraction is the agitation inseparable from their accomplishment.”
—George Gordon Noel Byron (17881824)