From 282dd8c237ea3265de04e66521a5830cc096db27 Mon Sep 17 00:00:00 2001 From: gongxuanzhang Date: Tue, 16 May 2023 11:25:41 +0800 Subject: [PATCH] update comment --- .../java/com/alibaba/excel/util/ClassUtils.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/easyexcel-core/src/main/java/com/alibaba/excel/util/ClassUtils.java b/easyexcel-core/src/main/java/com/alibaba/excel/util/ClassUtils.java index f62d1ec9..e1493763 100644 --- a/easyexcel-core/src/main/java/com/alibaba/excel/util/ClassUtils.java +++ b/easyexcel-core/src/main/java/com/alibaba/excel/util/ClassUtils.java @@ -36,6 +36,7 @@ import com.alibaba.excel.metadata.property.StyleProperty; import com.alibaba.excel.write.metadata.holder.WriteHolder; import lombok.AllArgsConstructor; +import lombok.Data; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; @@ -49,7 +50,7 @@ import org.springframework.cglib.beans.BeanMap; * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -102,7 +103,8 @@ public class ClassUtils { * @return */ public static ExcelContentProperty declaredExcelContentProperty(Map dataMap, Class headClazz, - String fieldName, ConfigurationHolder configurationHolder) { + String fieldName, + ConfigurationHolder configurationHolder) { Class clazz = null; if (dataMap instanceof BeanMap) { Object bean = ((BeanMap)dataMap).getBean(); @@ -137,7 +139,8 @@ public class ClassUtils { } private static ExcelContentProperty doGetExcelContentProperty(Class clazz, Class headClass, - String fieldName, ConfigurationHolder configurationHolder) { + String fieldName, + ConfigurationHolder configurationHolder) { ExcelContentProperty excelContentProperty = Optional.ofNullable( declaredFieldContentMap(clazz, configurationHolder)) .map(map -> map.get(fieldName)) @@ -406,8 +409,8 @@ public class ClassUtils { // Index sorted map Map filedIndexMap = MapUtils.newHashMap(); int fieldIndex = 0; - for (Integer includeColumnIndexe : includeColumnIndexes) { - filedIndexMap.put(includeColumnIndexe, fieldIndex++); + for (Integer includeColumnIndex : includeColumnIndexes) { + filedIndexMap.put(includeColumnIndex, fieldIndex++); } // rebuild sortedFieldMap @@ -551,6 +554,7 @@ public class ClassUtils { private String fieldName; } + public static void removeThreadLocalCache() { FIELD_THREAD_LOCAL.remove(); CLASS_CONTENT_THREAD_LOCAL.remove();