您的位置:首页 > 编程语言 > ASP

这两天学习JSF / AspectJ / Refactoring

2005-05-27 12:59 369 查看
这几天在学习JSF / AspectJ / Refactoring, 以及在eclipse下的使用。
AspectJ中的四个概念:
Pointcuts  - 切入点(类似于一个动作,一件事情,甚至一组动作或事情等等),具体可以是一个或者几个方法,实例化,赋值(set,get),异常,block ... 具体有一下这些(后面几个我的理解也是模糊的,那位高手可以准确这些概念,谢谢先):
Methods and Constructors
call(Signature)every call to any method or constructor matching Signature at the call site
execution(Signature)every execution of any method or constructor matching Signature
Fields
get(Signature)every reference to any field matching Signature
set(Signature)every assignment to any field matching Signature. The assigned value can be exposed with an args pointcut
Exception Handlers
handler(TypePattern)every exception handler for any Throwable type in TypePattern. The exception value can be exposed with an args pointcut
Advice
adviceexecution()every execution of any piece of advice
Initialization
staticinitialization(TypePattern)every execution of a static initializer for any type in TypePattern
initialization(Signature)every initialization of an object when the first constructor called in the type matches Signature, encompassing the return from the super constructor call to the return of the first-called constructor
preinitialization(Signature)every pre-initialization of an object when the first constructor called in the type matches Signature, encompassing the entry of the first-called constructor to the call to the super constructor
Lexical
within(TypePattern)every join point from code defined in a type in TypePattern
withincode(Signature)every join point from code defined in a method or constructor matching Signature
Instanceof checks and context exposurethis(Type or Id)every join point when the currently executing object is an instance of Type or Id's type target(Type or Id)every join point when the target executing object is an instance of Type or Id's type args(Type or Id, ...)every join point when the arguments are instances of Types or the types of the Ids Control Flowcflow(Pointcut)every join point in the control flow of each join point P picked out by Pointcut, including P itself cflowbelow(Pointcut)every join point below the control flow of each join point P picked out by Pointcut; does not include P itself Conditionalif(Expression)every join point when the boolean Expression is trueCombination! Pointcutevery join point not picked out by PointcutPointcut0 && Pointcut1each join point picked out by both Pointcut0 and Pointcut1Pointcut0 || Pointcut1each join point picked out by either Pointcut0 or Pointcut1( Pointcut )each join point picked out by Pointcut

Type Patterns
TypeNamePatternall types in TypeNamePattern
SubtypePatternall types in SubtypePattern, a pattern with a +.
ArrayTypePatternall types in ArrayTypePattern, a pattern with one or more []s.
!TypePatternall types not in TypePattern
TypePattern0 && TypePattern1all types in both TypePattern0 and TypePattern1
TypePattern0 || TypePattern1all types in either TypePattern0 or TypePattern1
( TypePattern )all types in TypePattern

Advice before( Formals ) runs before each join point after( Formals ) returning [ ( Formal ) ] runs after each join point that returns normally. The optional formal gives access to the returned value after( Formals ) throwing [ ( Formal ) ] runs after each join point that throws a Throwable. If the optional formal is present, runs only after each join point that throws a Throwable of the type of Formal, and Formal gives access to the Throwable exception value after( Formals ) runs after each join point regardless of whether it returns normally or throws a Throwable Type around( Formals ) runs in place of each join point. The join point can be executed by calling proceed, which takes the same number and types of arguments as the around advice. Inter-type member declarationsEach inter-type member is one of
Modifiers ReturnType OnType . Id ( Formals ) [ throws TypeList ] { Body } a method on OnType. abstract Modifiers ReturnType OnType . Id ( Formals ) [ throws TypeList ] ; an abstract method on OnType. Modifiers OnType . new ( Formals ) [ throws TypeList ] { Body } a constructor on OnType. Modifiers Type OnType . Id [ = Expression ] ; a field on OnType.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息