原因

it2024-06-26  40

easyexcel底层使用的是cglib来做反射工具包的:

com.alibaba.excel.read.listener.ModelBuildEventListener 类的第130行 BeanMap.create(resultModel).putAll(map); 最底层的是cglib的BeanMap的这个方法调用 abstract public Object put(Object bean, Object key, Object value); 复制代码

但是cglib使用的是Java的rt.jar里面的一个Introspector这个类的方法:

# Introspector.java 第520行 if (int.class.equals(argTypes[0]) && name.startsWith(GET_PREFIX)) { pd = new IndexedPropertyDescriptor(this.beanClass, name.substring(3), null, null, method, null); //下面这行判断,只获取返回值是void类型的setxxxx方法 } else if (void.class.equals(resultType) && name.startsWith(SET_PREFIX)) { // Simple setter pd = new PropertyDescriptor(this.beanClass, name.substring(3), null, method); if (throwsException(method, PropertyVetoException.class)) { pd.setConstrained(true); } }
最新回复(0)