Aspect: 模組化、可被重用的 cross-concern 物件,將多個 class 切割的模組,也是一種 class.
Joint point: 程式實際執行中的某一個點。
Advice: Aspect 在 Joint point 中執行的動作,意即 aspect 的實作就是 Advice, Advice 有三種 type: around, before, after。
Pointcut: 一段符合 joint point 的述語(斷言) ,描述每個joint point是要用哪個 aspect
Intruction。
Weave: Advice 被應用至物件的過程稱之為縫合(Weave),在 AOP 中,縫合的時機點有compile time, classload time, runtime.。
pointcut 表示法:
execution(modifiers-pattern? ret-type-pattern declaring-type-pattern? name-pattern(param-pattern)
其中ret-type-pattern、name-pattern(param-pattern)是可以省略的。
Q: AOP 的cut point一定要是介面才行嗎?
A: interface or non-final class
沒有留言:
張貼留言