java能过吗_java – 你能通过例子解释AspectJ的cFlow(P u00...
Does it mean “get all join points that are in P, then add all join
points that are in Q, then match on anything that flows from any of
them”?
不,這意味著獲得P和Q中的所有連接點,因此它是交叉點.
Or does it mean “get all join points in P that are also in Q”, i.e.
all flow points within X() below?
是的,“獲得P中的所有連接點也在Q中”,其余部分則為“否”.原因是切入點P定義了一個連接點:execution(void Example.P()),而切入點Q定義了一個連接點:execution(void Example.Q()).因為這些連接點不同,所以它們的交集是空集.從空集中獲取的cflow也是一個空集.這就是為什么在AspectJ文檔中,這個切入點標記為“不應該發生”.
希望這可以幫助!
這是Power Point演示文稿中的一個誤導性引用:
cflow(P && Q) means that you first combine the pointcuts P and Q, and
all the join points flowing from that are in this collection
“combine”一詞應改為“intersect”.
public class Example {
public void P() {
Q();
}
public void Q() {
}
public static void main(String[] args) {
new Example().P();
}
}
如果你運行它,輸出應該是這樣的:
pointcut: P join point: execution(Example.P())
pointcut: flowP join point: execution(Example.P())
pointcut: flowP join point: call(Example.Q())
pointcut: Q join point: execution(Example.Q())
pointcut: flowP join point: execution(Example.Q())
pointcut: flowQ join point: execution(Example.Q())
pointcut: flowPAndflowQ join point: execution(Example.Q())
這表明只有3個連接點:
A: execution(Example.P())
B: call(Example.Q())
C: execution(Example.Q())
切入點:
pointcut P includes only A
pointcut Q includes only C
pointcut flowP includes A, B and C
pointcut flowQ includes only C
pointcut flowPAndflowQ includes only C
我們現在可以看到P&& flow是一個空集,而flowP&& flowQ包括C.
我還包括了額外的切入點:cflow(P()&& publicMethods())(這個切入點的建議在代碼中被注釋掉了). publicMethods()是執行(public * *(..)).與cflow(P()&& Q())不同,它不會導致空集.
總結
以上是生活随笔為你收集整理的java能过吗_java – 你能通过例子解释AspectJ的cFlow(P u00...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 修改TFS与本地源代码映射路径
- 下一篇: commons-fileupload、s