私は長年このAOPメソッドを知っていましたが、私はAspectJを初めて使いました。 Androidアプリでこれを初めて使用しましたが、それについてはほとんど質問しません。AspectJのポイントカットアウトへの結合
私は、Javaコードを持っている:
private void mainView() {
... (some code)
<A>
setContentView(R.layout.main);
mView = findViewById(R.id.Main_Root);
mView.setOnTouchListener(this);
<B>
... (some code)
}
私は、次のAspectJのコードを持っている:
public aspect mainViewTiming {
pointcut callSetContentViewTiming():
call(* android.app.Activity.setContentView(..))
&& withincode(void mainView(..))
;
pointcut callFindViewById():
call(* android.app.Activity.findViewById(..))
&& withincode(void mainView(..))
;
pointcut callSetOnTouchListener():
call (* android.view.View.setOnTouchListener(..))
&& withincode(void mainView(..))
;
}
今、私の質問は、私はAspectJのを使用し、それがから実行するのにかかる時間を計算する方法ですか?
私は3つのポイントカットを持っていますが、私はそれらを組み合わせてこの効果を得る最良の方法を知りたいのですが?このリンクから、私は「CFLOW」を使用できることを学びました: http://www.eclipse.org/aspectj/doc/released/progguide/language-joinPoints.html
before(): cflow(callSetContentViewTiming()) && cflow(callFindViewById()) && callSetOnTouchListener() {
start = System.currentTimeMillis();
}
をしかし、私はそれが正しいかどうかわからないでした。そして、ポイントカットを組み合わせる際の違いを計算するにはどうしたらいいですか?そして、「after()」のようなものがありますか?
ありがとうございました。