我正在尋找一個使用AspectJ實現蟲洞模式實現的示例(如果Guice AOP有權實現此操作,會感興趣)。使用AspectJ實現蟲洞圖案
蠕蟲孔基本上可以讓你沿着例如呼叫流程傳遞附加參數:
// say we have
class foo {
public int m0 int a, int b) {
return m1(a,b);
}
public int m1 int a, int b) {
return m2(a,b);
}
public int m2 int a, int b) {
return a+b;
}
}
// and I wanted in a non-invasive manner to pass a third parameter of type
class context {
String userName;
long timeCalled;
String path;
}
// I could use an advise to say print the context information
// to trace what was going on without mucking up my method signatures
我相信這拉姆尼瓦斯·拉達在他的行動書的AspectJ這樣一個例子。
在此先感謝。
千恩萬謝@kriegaex ......我會拿起書 – user1172468