【游戏服务器Util】 提高反射的速度

来源:互联网 发布:通联支付 网络是 编辑:程序博客网 时间:2024/06/03 19:37
Constructor<?> constr = targetClass.getDeclaredConstructor();constr.setAccessible(true);Object inst = constr.newInstance();

Accessable属性是继承自AccessibleObject 类. 功能是启用或禁用安全检查

使用了method.setAccessible(true)后会大幅提升性能

0 0