|
|
@ -102,11 +102,11 @@ public class ClassUtils { |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static ExcelContentProperty declaredExcelContentProperty(Map<?, ?> dataMap, Class<?> headClazz, |
|
|
|
public static ExcelContentProperty declaredExcelContentProperty(Map<?, ?> dataMap, Class<?> headClazz, |
|
|
|
String fieldName, |
|
|
|
String fieldName, |
|
|
|
ConfigurationHolder configurationHolder) { |
|
|
|
ConfigurationHolder configurationHolder) { |
|
|
|
Class<?> clazz = null; |
|
|
|
Class<?> clazz = null; |
|
|
|
if (dataMap instanceof BeanMap) { |
|
|
|
if (dataMap instanceof BeanMap) { |
|
|
|
Object bean = ((BeanMap) dataMap).getBean(); |
|
|
|
Object bean = ((BeanMap)dataMap).getBean(); |
|
|
|
if (bean != null) { |
|
|
|
if (bean != null) { |
|
|
|
clazz = bean.getClass(); |
|
|
|
clazz = bean.getClass(); |
|
|
|
} |
|
|
|
} |
|
|
@ -115,7 +115,7 @@ public class ClassUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static ExcelContentProperty getExcelContentProperty(Class<?> clazz, Class<?> headClass, String fieldName, |
|
|
|
private static ExcelContentProperty getExcelContentProperty(Class<?> clazz, Class<?> headClass, String fieldName, |
|
|
|
ConfigurationHolder configurationHolder) { |
|
|
|
ConfigurationHolder configurationHolder) { |
|
|
|
switch (configurationHolder.globalConfiguration().getFiledCacheLocation()) { |
|
|
|
switch (configurationHolder.globalConfiguration().getFiledCacheLocation()) { |
|
|
|
case THREAD_LOCAL: |
|
|
|
case THREAD_LOCAL: |
|
|
|
Map<ContentPropertyKey, ExcelContentProperty> contentCacheMap = CONTENT_THREAD_LOCAL.get(); |
|
|
|
Map<ContentPropertyKey, ExcelContentProperty> contentCacheMap = CONTENT_THREAD_LOCAL.get(); |
|
|
@ -138,8 +138,8 @@ public class ClassUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static ExcelContentProperty doGetExcelContentProperty(Class<?> clazz, Class<?> headClass, |
|
|
|
private static ExcelContentProperty doGetExcelContentProperty(Class<?> clazz, Class<?> headClass, |
|
|
|
String fieldName, |
|
|
|
String fieldName, |
|
|
|
ConfigurationHolder configurationHolder) { |
|
|
|
ConfigurationHolder configurationHolder) { |
|
|
|
ExcelContentProperty excelContentProperty = Optional.ofNullable( |
|
|
|
ExcelContentProperty excelContentProperty = Optional.ofNullable( |
|
|
|
declaredFieldContentMap(clazz, configurationHolder)) |
|
|
|
declaredFieldContentMap(clazz, configurationHolder)) |
|
|
|
.map(map -> map.get(fieldName)) |
|
|
|
.map(map -> map.get(fieldName)) |
|
|
@ -158,7 +158,7 @@ public class ClassUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void combineExcelContentProperty(ExcelContentProperty combineExcelContentProperty, |
|
|
|
public static void combineExcelContentProperty(ExcelContentProperty combineExcelContentProperty, |
|
|
|
ExcelContentProperty excelContentProperty) { |
|
|
|
ExcelContentProperty excelContentProperty) { |
|
|
|
if (excelContentProperty == null) { |
|
|
|
if (excelContentProperty == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -187,7 +187,7 @@ public class ClassUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static Map<String, ExcelContentProperty> declaredFieldContentMap(Class<?> clazz, |
|
|
|
private static Map<String, ExcelContentProperty> declaredFieldContentMap(Class<?> clazz, |
|
|
|
ConfigurationHolder configurationHolder) { |
|
|
|
ConfigurationHolder configurationHolder) { |
|
|
|
if (clazz == null) { |
|
|
|
if (clazz == null) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -324,7 +324,7 @@ public class ClassUtils { |
|
|
|
return fieldCache; |
|
|
|
return fieldCache; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
WriteHolder writeHolder = (WriteHolder) configurationHolder; |
|
|
|
WriteHolder writeHolder = (WriteHolder)configurationHolder; |
|
|
|
|
|
|
|
|
|
|
|
boolean needIgnore = !CollectionUtils.isEmpty(writeHolder.excludeColumnFieldNames()) |
|
|
|
boolean needIgnore = !CollectionUtils.isEmpty(writeHolder.excludeColumnFieldNames()) |
|
|
|
|| !CollectionUtils.isEmpty(writeHolder.excludeColumnIndexes()) |
|
|
|
|| !CollectionUtils.isEmpty(writeHolder.excludeColumnIndexes()) |
|
|
@ -427,7 +427,7 @@ public class ClassUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static Map<Integer, FieldWrapper> buildSortedAllFieldMap(Map<Integer, List<FieldWrapper>> orderFieldMap, |
|
|
|
private static Map<Integer, FieldWrapper> buildSortedAllFieldMap(Map<Integer, List<FieldWrapper>> orderFieldMap, |
|
|
|
Map<Integer, FieldWrapper> indexFieldMap) { |
|
|
|
Map<Integer, FieldWrapper> indexFieldMap) { |
|
|
|
|
|
|
|
|
|
|
|
Map<Integer, FieldWrapper> sortedAllFieldMap = new HashMap<>( |
|
|
|
Map<Integer, FieldWrapper> sortedAllFieldMap = new HashMap<>( |
|
|
|
(orderFieldMap.size() + indexFieldMap.size()) * 4 / 3 + 1); |
|
|
|
(orderFieldMap.size() + indexFieldMap.size()) * 4 / 3 + 1); |
|
|
@ -450,8 +450,8 @@ public class ClassUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void declaredOneField(Field field, Map<Integer, List<FieldWrapper>> orderFieldMap, |
|
|
|
private static void declaredOneField(Field field, Map<Integer, List<FieldWrapper>> orderFieldMap, |
|
|
|
Map<Integer, FieldWrapper> indexFieldMap, Set<String> ignoreSet, |
|
|
|
Map<Integer, FieldWrapper> indexFieldMap, Set<String> ignoreSet, |
|
|
|
ExcelIgnoreUnannotated excelIgnoreUnannotated) { |
|
|
|
ExcelIgnoreUnannotated excelIgnoreUnannotated) { |
|
|
|
String fieldName = FieldUtils.resolveCglibFieldName(field); |
|
|
|
String fieldName = FieldUtils.resolveCglibFieldName(field); |
|
|
|
FieldWrapper fieldWrapper = new FieldWrapper(); |
|
|
|
FieldWrapper fieldWrapper = new FieldWrapper(); |
|
|
|
fieldWrapper.setField(field); |
|
|
|
fieldWrapper.setField(field); |
|
|
|