【8.3.0】【scanner】更新format工具类

master
stylefeng 2024-08-06 23:55:39 +08:00
parent 0d8ac91a3f
commit 20a176e3f2
1 changed files with 5 additions and 4 deletions

View File

@ -2,6 +2,7 @@ package cn.stylefeng.roses.kernel.rule.format;
import cn.stylefeng.roses.kernel.rule.base.SimpleFieldFormatProcess;
import cn.stylefeng.roses.kernel.rule.enums.FieldTypeEnum;
import cn.stylefeng.roses.kernel.rule.pojo.clazz.ClassParseResult;
import cn.stylefeng.roses.kernel.rule.util.ClassTypeUtil;
import cn.stylefeng.roses.kernel.rule.util.MixFieldTypeUtil;
import cn.stylefeng.roses.kernel.rule.util.ObjectConvertUtil;
@ -27,15 +28,15 @@ public abstract class BaseSimpleFieldFormatProcess implements SimpleFieldFormatP
public Object formatProcess(Object originValue) {
// 先获取是基础类型还是集合类型
FieldTypeEnum classFieldType = ClassTypeUtil.getClassFieldType(originValue.getClass());
ClassParseResult classParseResult = ClassTypeUtil.getClassFieldType(originValue.getClass());
// 基础类型,直接转化
if (FieldTypeEnum.BASIC.equals(classFieldType)) {
if (FieldTypeEnum.BASIC.equals(classParseResult.getFieldTypeEnum())) {
return this.simpleItemFormat(originValue);
}
// 集合类型
if (FieldTypeEnum.BASE_COLLECTION.equals(classFieldType)) {
if (FieldTypeEnum.COLLECTION.equals(classParseResult.getFieldTypeEnum())) {
Collection<?> originValueList = (Collection<?>) originValue;
List<Object> parsedList = new ArrayList<>();
for (Object itemObject : originValueList) {
@ -45,7 +46,7 @@ public abstract class BaseSimpleFieldFormatProcess implements SimpleFieldFormatP
}
// 数组类型
if (FieldTypeEnum.BASE_ARRAY.equals(classFieldType)) {
if (FieldTypeEnum.ARRAY.equals(classParseResult.getFieldTypeEnum())) {
Object[] originValueArray = ObjectConvertUtil.objToArray(originValue);
List<Object> parsedList = new ArrayList<>();
for (Object itemObject : originValueArray) {