1
我現在有一個使用Module
IMPL以下綁定:關閉匹配在谷歌吉斯
binder.bindInterceptor(Matchers.any(), Matchers.any(),
new WidgetInterceptor());
我希望能夠以編程方式開啓/關閉該功能,並在這裏就是我熟了:
private boolean widgetInterceptionEnabled = true;
public void configure(Binder binder) {
Matcher<Object> matcher = null;
if(widgetInterceptionEnabled)
matcher = Matchers.any();
else
matcher = Matchers.not(Matchers.any());
binder.bindInterceptor(Matchers.any(), matcher,
new WidgetInterceptor());
}
這是正確的方式告訴吉斯不匹配什麼?或者我使用API錯誤?
在此先感謝!
是啊!總是很高興有一個全新的視角! – IAmYourFaja 2012-01-31 15:49:12