aspect
The definition is as follows:
[Access Specification] aspect
[EXTENDS CLASS-OR-Aspect-Name]
[Implements Interface-List]
[
... aspect body
}
Keyword Aspect declares an aspect. Every aspect has a name, other parts of the program can use this name to access this aspect. Aspects can define an access specification, extend an aspect or class, and implement an interface. Aspects include code indicating cross-cutting rules. Notification, guidance, and compile time declaration can be defined within aspects. Clear points can be defined within the class, interface, and aspects, in terms of cutting points can have an access specification and can be stated as abstract. Other notices, guidance, and compile time to adhere to access specifications.
A similar is similar to the class:
Aspects can include data members and methods;
Aspects can contain an access specification;
Aspects can declare their own declarations;
Public abstract aspect abstractLogging {
Public Abstract Pointcut Logpoints (); <- Abstract Clearance Point
Public Abstract Logger getLogger (); <- Abstract method
Before (): Logpoints () {
GetLogger (). log (Level.info, "Before:" thisjoinpoint);
}
}
Aspects can be extended or abstract, and the interface can also be implemented;
Public aspect banlogging extends abstractLogging {
Public Pointcut Logpoints (): Call (* Banking .. * (..));
Public logger getLogger () {
Return Logger.getlogger ("Banking");
}
}
Aspects can be included as embedded aspects in class or interface;
Views between aspects and classes:
Aspects cannot be directly instantiated;
Aspects cannot inherit specific aspects;
Aspects have some special access rights;