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:
“All propaganda or popularization involves a putting of the complex into the simple, but such a move is instantly deconstructive. For if the complex can be put into the simple, then it cannot be as complex as it seemed in the first place; and if the simple can be an adequate medium of such complexity, then it cannot after all be as simple as all that.”
—Terry Eagleton (b. 1943)
“The language of Friendship is not words, but meanings. It is an intelligence above language.”
—Henry David Thoreau (18171862)
“It is possibleindeed possible even according to the old conception of logicto give in advance a description of all true logical propositions. Hence there can never be surprises in logic.”
—Ludwig Wittgenstein (18891951)