mirror of https://gitee.com/stylefeng/roses
【7.1.6】【scanner】资源扫描排除不常用字段
parent
e99ee5d137
commit
b5ba5c1d9b
|
@ -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");
|
||||
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue