正在显示
1 个修改的文件
包含
3 行增加
和
4 行删除
| @@ -6,7 +6,6 @@ import java.io.IOException; | @@ -6,7 +6,6 @@ import java.io.IOException; | ||
| 6 | import java.io.InputStream; | 6 | import java.io.InputStream; |
| 7 | import java.io.OutputStream; | 7 | import java.io.OutputStream; |
| 8 | import java.lang.reflect.Field; | 8 | import java.lang.reflect.Field; |
| 9 | -import java.lang.reflect.Method; | ||
| 10 | import java.math.BigDecimal; | 9 | import java.math.BigDecimal; |
| 11 | import java.text.DecimalFormat; | 10 | import java.text.DecimalFormat; |
| 12 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
| @@ -864,9 +863,9 @@ public class ExcelUtil<T> | @@ -864,9 +863,9 @@ public class ExcelUtil<T> | ||
| 864 | if (StringUtils.isNotEmpty(name)) | 863 | if (StringUtils.isNotEmpty(name)) |
| 865 | { | 864 | { |
| 866 | Class<?> clazz = o.getClass(); | 865 | Class<?> clazz = o.getClass(); |
| 867 | - String methodName = "get" + name.substring(0, 1).toUpperCase() + name.substring(1); | ||
| 868 | - Method method = clazz.getMethod(methodName); | ||
| 869 | - o = method.invoke(o); | 866 | + Field field = clazz.getDeclaredField(name); |
| 867 | + field.setAccessible(true); | ||
| 868 | + o = field.get(o); | ||
| 870 | } | 869 | } |
| 871 | return o; | 870 | return o; |
| 872 | } | 871 | } |
-
请 注册 或 登录 后发表评论