设为首页 加入收藏

TOP

动态代理-cglib分析(三)
2023-07-26 08:17:14 】 浏览:109
Tags:-cglib分析
Integer(var10000.hashCode()); case 3: return var10000.clone(); case 4: return var10000.newInstance((Class[])var3[0], (Object[])var3[1], (Callback[])var3[2]); case 5: return var10000.newInstance((Callback[])var3[0]); case 6: return var10000.newInstance((Callback)var3[0]); case 7: var10000.test(); return null; case 8: e34eec9a.CGLIB$SET_THREAD_CALLBACKS((Callback[])var3[0]); return null; case 9: e34eec9a.CGLIB$SET_STATIC_CALLBACKS((Callback[])var3[0]); return null; case 10: var10000.setCallbacks((Callback[])var3[0]); return null; case 11: return var10000.getCallback(((Number)var3[0]).intValue()); case 12: return var10000.getCallbacks(); case 13: var10000.setCallback(((Number)var3[0]).intValue(), (Callback)var3[1]); return null; case 14: return e34eec9a.CGLIB$findMethodProxy((Signature)var3[0]); case 15: e34eec9a.CGLIB$STATICHOOK1(); return null; case 16: var10000.CGLIB$test$0(); return null; case 17: return new Integer(var10000.CGLIB$hashCode$3()); case 18: return new Boolean(var10000.CGLIB$equals$1(var3[0])); case 19: return var10000.CGLIB$toString$2(); case 20: return var10000.CGLIB$clone$4(); } } catch (Throwable var4) { throw new InvocationTargetException(var4); } throw new IllegalArgumentException("Cannot find matching method/constructor"); }

例如传入的index 是16 那么执行的就是 var10000.CGLIB$test$0();

如果传入的index是 7 那么执行的就是var10000.test();

var10000 是传入对象强转为UserService..EnhancerByCGLIB..e34eec9a类的对象,UserService..EnhancerByCGLIB..e34eec9a类其实就是UserService的代理类

invokeSuper结论

所以当我们执行invokeSuper方法的时候,不能传入原始类(UserService)只能传入代理类对象,不然就无法转换成为代理类类型

所以FastClass 快的地方就是预先把所有的方法信息都生成了对应的index,在真正的去执行的时候不用再去找Method对象,直接传入对应方法的index就可以直接执行对应的方法了

首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇【踩坑记录】@Transactional注解.. 下一篇手把手教你将Eureka升级Nacos注册..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目