这两天学习JSF / AspectJ / Refactoring

这几天在学习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 exposure
this(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 Flow
cflow(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
Conditional
if(Expression)every join point when the boolean Expression is true
Combination
! Pointcutevery join point not picked out by Pointcut
Pointcut0 && Pointcut1each join point picked out by both Pointcut0 and Pointcut1
Pointcut0 || 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 declarations

Each 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.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值