AspectJ pointcut to method call in specific methods

给你一囗甜甜゛ 提交于 2019-12-05 06:53:29

Maybe withincode will work:

call(public void Parent.foo()) && (withincode(* Child.bar1()) || withincode(* Child.bar3()) );

Alternatively you could try the cflow pointcut:

pointcut bar1(): call(* Child.bar1());
pointcut bar3(): call(* Child.bar3());

call(public void Parent.foo()) && (cflow(bar1()) || cflow(bar3());

Look here for a pointcut reference

Think what you want is instead of doing the execution clauses (which have the added disadvantage of requiring additions for each new caller), is to use target, e.g. something like:

target(Child) && call(public void Parent.foo()).

Somewhat surprisingly, I have found the pointcut guides in the eclipse documentation quite useful. They are here.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!