📄 auditorinterceptor.java
字号:
package examples.stateless.interceptors;
import javax.interceptor.AroundInvoke;
import javax.interceptor.InvocationContext;
public class AuditorInterceptor {
@AroundInvoke
public Object checkCost(InvocationContext inv) throws Exception {
if (inv.getMethod().getName().startsWith("getTax")) {
Object[] o = inv.getParameters();
double cost = ((Double)o[0]).doubleValue();
if (cost > 50) {
System.out.println("Cost is > 50!");
}
}
return inv.proceed();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -