Excel表格网

java记录方法被执行次数

87 2024-03-03 09:56 admin   手机版
public class MethodExecutionCounterProxy implements InvocationHandler { private Object target; private int count = 0; public MethodExecutionCounterProxy(Object target) { this.target = target; } @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { count++; System.out.println("Method " + method.getName() + " has been called " + count + " times."); return method.invoke(target, args); } }
顶一下
(0)
0%
踩一下
(0)
0%
相关评论
我要评论
用户名: 验证码:点击我更换图片