【7.1.6】【scanner】资源扫描排除不常用字段

pull/26/head
fengshuonan 2022-01-24 20:54:20 +08:00
parent e99ee5d137
commit b5ba5c1d9b
2 changed files with 17 additions and 0 deletions

View File

@ -24,6 +24,10 @@
*/
package cn.stylefeng.roses.kernel.scanner.api.constants;
import cn.hutool.core.collection.ListUtil;
import java.util.List;
/**
*
*
@ -77,4 +81,9 @@ public interface ScannerConstants {
*/
String DEVOPS_REQUEST_PATH = "/scannerResource/addExternalResource";
/**
*
*/
List<String> DONT_PARSE_FIELD = ListUtil.list(false, "serialVersionUID", "delFlag", "createTime", "createUser", "updateTime", "updateUser");
}

View File

@ -1,5 +1,6 @@
package cn.stylefeng.roses.kernel.scanner.api.factory;
import cn.stylefeng.roses.kernel.scanner.api.constants.ScannerConstants;
import cn.stylefeng.roses.kernel.scanner.api.context.MetadataContext;
import cn.stylefeng.roses.kernel.scanner.api.enums.FieldTypeEnum;
import cn.stylefeng.roses.kernel.scanner.api.pojo.resource.FieldMetadata;
@ -82,6 +83,13 @@ public class ClassDetailMetadataFactory {
for (Field field : fields) {
FieldMetadata fieldInfo;
// 判断字段是否是基础字段例如serialVersionUID或者delFlag等字段
if (ScannerConstants.DONT_PARSE_FIELD.contains(field.getName())) {
continue;
}
// 判断该实体是否被解析过,防止无限递归解析实体
if (MetadataContext.ensureFieldClassHaveParse(uuid, field.getGenericType())) {
fieldInfo = FieldDescriptionUtil.createBasicMetadata(field, uuid);
} else {