diff --git a/.idea/compiler.xml b/.idea/compiler.xml index a336ab4..b94671e 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -7,6 +7,14 @@ + + + + + + + + diff --git a/pom.xml b/pom.xml index c5d8677..a6e3474 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,7 @@ 2.15.4 4.7.5 5.10.2 + 1.18.34 3.5.1 3.1.2 @@ -71,11 +72,34 @@ ${junit.version} test + + + org.projectlombok + lombok + ${lombok.version} + provided + serialization-schema-checker-${project.version} + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + ${maven.compiler.source} + ${maven.compiler.target} + + + org.projectlombok + lombok + ${lombok.version} + + + + org.apache.maven.plugins maven-deploy-plugin diff --git a/src/main/java/com/codechecker/cache/config/CheckerConfig.java b/src/main/java/com/codechecker/cache/config/CheckerConfig.java index 315ec92..ef16335 100644 --- a/src/main/java/com/codechecker/cache/config/CheckerConfig.java +++ b/src/main/java/com/codechecker/cache/config/CheckerConfig.java @@ -1,5 +1,7 @@ package com.codechecker.cache.config; +import lombok.Data; + import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; @@ -8,6 +10,7 @@ import java.util.Map; /** * 检测器运行配置。由 {@link ConfigLoader} 加载 jar 内默认配置并与业务配置深度合并后构建。 */ +@Data public class CheckerConfig { /** 总开关:false 时跳过检测与通知(流水线 exit 0) */ @@ -36,89 +39,32 @@ public class CheckerConfig { private List excludeModules = new ArrayList<>(); + public boolean isBlockMode() { + return "block".equalsIgnoreCase(mode); + } + /** 企微通知相关配置。 */ + @Data public static class Notify { private boolean enabled = true; /** 企微机器人 Webhook 完整 URL */ private String webhookUrl = ""; private boolean notifyOnClean = false; private String titlePrefix = "[序列化结构变更]"; - - public boolean isEnabled() { - return enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - public String getWebhookUrl() { - return webhookUrl; - } - - public void setWebhookUrl(String webhookUrl) { - this.webhookUrl = webhookUrl; - } - - public boolean isNotifyOnClean() { - return notifyOnClean; - } - - public void setNotifyOnClean(boolean notifyOnClean) { - this.notifyOnClean = notifyOnClean; - } - - public String getTitlePrefix() { - return titlePrefix; - } - - public void setTitlePrefix(String titlePrefix) { - this.titlePrefix = titlePrefix; - } } /** 忽略规则:key / 文件路径 / 写入方法 / MQ destination。 */ + @Data public static class Ignore { private List keyPatterns = new ArrayList<>(); private List filePatterns = new ArrayList<>(); private List writerMethods = new ArrayList<>(); /** 忽略的 MQ destination 模式(topic / topic:tag) */ private List mqDestinations = new ArrayList<>(); - - public List getKeyPatterns() { - return keyPatterns; - } - - public void setKeyPatterns(List keyPatterns) { - this.keyPatterns = keyPatterns; - } - - public List getFilePatterns() { - return filePatterns; - } - - public void setFilePatterns(List filePatterns) { - this.filePatterns = filePatterns; - } - - public List getWriterMethods() { - return writerMethods; - } - - public void setWriterMethods(List writerMethods) { - this.writerMethods = writerMethods; - } - - public List getMqDestinations() { - return mqDestinations; - } - - public void setMqDestinations(List mqDestinations) { - this.mqDestinations = mqDestinations; - } } /** 检测模式与推断参数(Redis W*、MQ MQ*、读侧补强开关等)。 */ + @Data public static class Detection { private List patterns = new ArrayList<>(); /** MQ 投递检测模式:MQ01~MQ05、MQ-K01~MQ-K04 */ @@ -129,255 +75,29 @@ public class CheckerConfig { private boolean readHintsEnabled = true; /** MQ-R:读侧 Listener / parse 补强 */ private boolean mqReadHintsEnabled = true; - - public List getPatterns() { - return patterns; - } - - public void setPatterns(List patterns) { - this.patterns = patterns; - } - - public List getMqPatterns() { - return mqPatterns; - } - - public void setMqPatterns(List mqPatterns) { - this.mqPatterns = mqPatterns; - } - - public double getMinConfidence() { - return minConfidence; - } - - public void setMinConfidence(double minConfidence) { - this.minConfidence = minConfidence; - } - - public int getMaxFieldDepth() { - return maxFieldDepth; - } - - public void setMaxFieldDepth(int maxFieldDepth) { - this.maxFieldDepth = maxFieldDepth; - } - - public boolean isReadHintsEnabled() { - return readHintsEnabled; - } - - public void setReadHintsEnabled(boolean readHintsEnabled) { - this.readHintsEnabled = readHintsEnabled; - } - - public boolean isMqReadHintsEnabled() { - return mqReadHintsEnabled; - } - - public void setMqReadHintsEnabled(boolean mqReadHintsEnabled) { - this.mqReadHintsEnabled = mqReadHintsEnabled; - } } /** * 人工补充映射:在自动推断不准时指定写入方法对应的 key 模式与 value 类型。 */ + @Data public static class ManualMapping { private String id; private String writerMethod; private String keyPattern; private String valueType; private String description; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWriterMethod() { - return writerMethod; - } - - public void setWriterMethod(String writerMethod) { - this.writerMethod = writerMethod; - } - - public String getKeyPattern() { - return keyPattern; - } - - public void setKeyPattern(String keyPattern) { - this.keyPattern = keyPattern; - } - - public String getValueType() { - return valueType; - } - - public void setValueType(String valueType) { - this.valueType = valueType; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } } /** * 抑制规则:对已知误报按 key 模式和/或变更类型跳过告警。 */ + @Data public static class Suppression { private String id; private String writerMethod; private String keyPattern; private List changeTypes = new ArrayList<>(); private String reason; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getWriterMethod() { - return writerMethod; - } - - public void setWriterMethod(String writerMethod) { - this.writerMethod = writerMethod; - } - - public String getKeyPattern() { - return keyPattern; - } - - public void setKeyPattern(String keyPattern) { - this.keyPattern = keyPattern; - } - - public List getChangeTypes() { - return changeTypes; - } - - public void setChangeTypes(List changeTypes) { - this.changeTypes = changeTypes; - } - - public String getReason() { - return reason; - } - - public void setReason(String reason) { - this.reason = reason; - } - } - - public boolean isEnabled() { - return enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - public String getMode() { - return mode; - } - - public void setMode(String mode) { - this.mode = mode; - } - - public boolean isScanTestSources() { - return scanTestSources; - } - - public void setScanTestSources(boolean scanTestSources) { - this.scanTestSources = scanTestSources; - } - - public List getSourceRoots() { - return sourceRoots; - } - - public void setSourceRoots(List sourceRoots) { - this.sourceRoots = sourceRoots; - } - - public Notify getNotify() { - return notify; - } - - public void setNotify(Notify notify) { - this.notify = notify; - } - - public Ignore getIgnore() { - return ignore; - } - - public void setIgnore(Ignore ignore) { - this.ignore = ignore; - } - - public Detection getDetection() { - return detection; - } - - public void setDetection(Detection detection) { - this.detection = detection; - } - - public Map getSeverityOverrides() { - return severityOverrides; - } - - public void setSeverityOverrides(Map severityOverrides) { - this.severityOverrides = severityOverrides; - } - - public List getManualMappings() { - return manualMappings; - } - - public void setManualMappings(List manualMappings) { - this.manualMappings = manualMappings; - } - - public List getSuppressions() { - return suppressions; - } - - public void setSuppressions(List suppressions) { - this.suppressions = suppressions; - } - - public List getIncludeModules() { - return includeModules; - } - - public void setIncludeModules(List includeModules) { - this.includeModules = includeModules; - } - - public List getExcludeModules() { - return excludeModules; - } - - public void setExcludeModules(List excludeModules) { - this.excludeModules = excludeModules; - } - - public boolean isBlockMode() { - return "block".equalsIgnoreCase(mode); } } diff --git a/src/main/java/com/codechecker/cache/detector/CacheReadHint.java b/src/main/java/com/codechecker/cache/detector/CacheReadHint.java index 3cead8c..6d433bf 100644 --- a/src/main/java/com/codechecker/cache/detector/CacheReadHint.java +++ b/src/main/java/com/codechecker/cache/detector/CacheReadHint.java @@ -1,9 +1,12 @@ package com.codechecker.cache.detector; +import lombok.Data; + /** * 读侧反序列化类型提示(W06):从 parseObject / getJsonToBean 等推断「缓存 value 被当成什么类型用」。 * 不单独产生告警,仅用于补强同文件/同 key 写入点的 value 类型。 */ +@Data public class CacheReadHint { private String filePath; @@ -17,76 +20,4 @@ public class CacheReadHint { private String resolvedValueType; private boolean rootArray; private double confidence = 0.7; - - public String getFilePath() { - return filePath; - } - - public void setFilePath(String filePath) { - this.filePath = filePath; - } - - public int getLineNumber() { - return lineNumber; - } - - public void setLineNumber(int lineNumber) { - this.lineNumber = lineNumber; - } - - public String getEnclosingClass() { - return enclosingClass; - } - - public void setEnclosingClass(String enclosingClass) { - this.enclosingClass = enclosingClass; - } - - public String getEnclosingMethod() { - return enclosingMethod; - } - - public void setEnclosingMethod(String enclosingMethod) { - this.enclosingMethod = enclosingMethod; - } - - public String getResolvedKeyPattern() { - return resolvedKeyPattern; - } - - public void setResolvedKeyPattern(String resolvedKeyPattern) { - this.resolvedKeyPattern = resolvedKeyPattern; - } - - public String getKeyExpression() { - return keyExpression; - } - - public void setKeyExpression(String keyExpression) { - this.keyExpression = keyExpression; - } - - public String getResolvedValueType() { - return resolvedValueType; - } - - public void setResolvedValueType(String resolvedValueType) { - this.resolvedValueType = resolvedValueType; - } - - public boolean isRootArray() { - return rootArray; - } - - public void setRootArray(boolean rootArray) { - this.rootArray = rootArray; - } - - public double getConfidence() { - return confidence; - } - - public void setConfidence(double confidence) { - this.confidence = confidence; - } } diff --git a/src/main/java/com/codechecker/cache/detector/WritePoint.java b/src/main/java/com/codechecker/cache/detector/WritePoint.java index fcf8d26..1c5e0d3 100644 --- a/src/main/java/com/codechecker/cache/detector/WritePoint.java +++ b/src/main/java/com/codechecker/cache/detector/WritePoint.java @@ -1,8 +1,13 @@ package com.codechecker.cache.detector; +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; + /** * 一个 Redis / MQ value 写入(投递)点的静态描述。 */ +@Data public class WritePoint { public static final String CHANNEL_REDIS = "REDIS"; @@ -25,8 +30,13 @@ public class WritePoint { private double confidence = 1.0; /** REDIS / ROCKETMQ / KAFKA;默认 REDIS 兼容现网 */ + @Setter(AccessLevel.NONE) private String channel = CHANNEL_REDIS; + public void setChannel(String channel) { + this.channel = channel == null || channel.isEmpty() ? CHANNEL_REDIS : channel; + } + /** 稳定标识:用于在 old/new 两个版本间配对同一写入点 */ public String signature() { return enclosingClass + "#" + enclosingMethod + "|" + normalizeKey(); @@ -41,102 +51,6 @@ public class WritePoint { return CHANNEL_ROCKETMQ.equals(channel) || CHANNEL_KAFKA.equals(channel); } - public String getFilePath() { - return filePath; - } - - public void setFilePath(String filePath) { - this.filePath = filePath; - } - - public int getLineNumber() { - return lineNumber; - } - - public void setLineNumber(int lineNumber) { - this.lineNumber = lineNumber; - } - - public String getEnclosingClass() { - return enclosingClass; - } - - public void setEnclosingClass(String enclosingClass) { - this.enclosingClass = enclosingClass; - } - - public String getEnclosingMethod() { - return enclosingMethod; - } - - public void setEnclosingMethod(String enclosingMethod) { - this.enclosingMethod = enclosingMethod; - } - - public String getPattern() { - return pattern; - } - - public void setPattern(String pattern) { - this.pattern = pattern; - } - - public String getKeyExpression() { - return keyExpression; - } - - public void setKeyExpression(String keyExpression) { - this.keyExpression = keyExpression; - } - - public String getResolvedKeyPattern() { - return resolvedKeyPattern; - } - - public void setResolvedKeyPattern(String resolvedKeyPattern) { - this.resolvedKeyPattern = resolvedKeyPattern; - } - - public String getValueExpression() { - return valueExpression; - } - - public void setValueExpression(String valueExpression) { - this.valueExpression = valueExpression; - } - - public String getResolvedValueType() { - return resolvedValueType; - } - - public void setResolvedValueType(String resolvedValueType) { - this.resolvedValueType = resolvedValueType; - } - - public boolean isRootArray() { - return rootArray; - } - - public void setRootArray(boolean rootArray) { - this.rootArray = rootArray; - } - - public double getConfidence() { - return confidence; - } - - public void setConfidence(double confidence) { - this.confidence = confidence; - } - - public String getChannel() { - return channel; - } - - public void setChannel(String channel) { - this.channel = channel == null || channel.isEmpty() ? CHANNEL_REDIS : channel; - } - /** * @return 展示用写入位置,形如 {@code SimpleClass#method:line} */ diff --git a/src/main/java/com/codechecker/cache/diff/SchemaChange.java b/src/main/java/com/codechecker/cache/diff/SchemaChange.java index 553ec46..07d22fb 100644 --- a/src/main/java/com/codechecker/cache/diff/SchemaChange.java +++ b/src/main/java/com/codechecker/cache/diff/SchemaChange.java @@ -1,9 +1,12 @@ package com.codechecker.cache.diff; +import lombok.Data; + /** * 一条结构变更记录:关联 key/destination、写入位置、字段路径与前后取值说明。 *

由 {@link SchemaDiffer} 或分析器在「新增/删除写入点」时生成,再进入报告明细。

*/ +@Data public class SchemaChange { private Severity severity; @@ -21,84 +24,4 @@ public class SchemaChange { this.changeType = changeType; this.severity = changeType.getDefaultSeverity(); } - - public Severity getSeverity() { - return severity; - } - - public void setSeverity(Severity severity) { - this.severity = severity; - } - - public ChangeType getChangeType() { - return changeType; - } - - public void setChangeType(ChangeType changeType) { - this.changeType = changeType; - } - - public String getKeyPattern() { - return keyPattern; - } - - public void setKeyPattern(String keyPattern) { - this.keyPattern = keyPattern; - } - - public String getKeyExpression() { - return keyExpression; - } - - public void setKeyExpression(String keyExpression) { - this.keyExpression = keyExpression; - } - - public String getWriteLocation() { - return writeLocation; - } - - public void setWriteLocation(String writeLocation) { - this.writeLocation = writeLocation; - } - - public String getValueType() { - return valueType; - } - - public void setValueType(String valueType) { - this.valueType = valueType; - } - - public String getFieldPath() { - return fieldPath; - } - - public void setFieldPath(String fieldPath) { - this.fieldPath = fieldPath; - } - - public String getOldValue() { - return oldValue; - } - - public void setOldValue(String oldValue) { - this.oldValue = oldValue; - } - - public String getNewValue() { - return newValue; - } - - public void setNewValue(String newValue) { - this.newValue = newValue; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } } diff --git a/src/main/java/com/codechecker/cache/report/CheckReport.java b/src/main/java/com/codechecker/cache/report/CheckReport.java index 250ddec..6a1020c 100644 --- a/src/main/java/com/codechecker/cache/report/CheckReport.java +++ b/src/main/java/com/codechecker/cache/report/CheckReport.java @@ -2,6 +2,7 @@ package com.codechecker.cache.report; import com.codechecker.cache.diff.SchemaChange; import com.codechecker.cache.diff.Severity; +import lombok.Data; import java.util.ArrayList; import java.util.List; @@ -10,6 +11,7 @@ import java.util.List; * 一次检测的完整结果:元信息、字段级 {@link SchemaChange} 列表、按 Key/Topic 聚合的 * {@link KeyStructureChange},以及是否阻断流水线与建议退出码。 */ +@Data public class CheckReport { private String repository; @@ -34,84 +36,4 @@ public class CheckReport { public long count(Severity severity) { return changes.stream().filter(c -> c.getSeverity() == severity).count(); } - - public String getRepository() { - return repository; - } - - public void setRepository(String repository) { - this.repository = repository; - } - - public String getBranch() { - return branch; - } - - public void setBranch(String branch) { - this.branch = branch; - } - - public String getOldSha() { - return oldSha; - } - - public void setOldSha(String oldSha) { - this.oldSha = oldSha; - } - - public String getNewSha() { - return newSha; - } - - public void setNewSha(String newSha) { - this.newSha = newSha; - } - - public String getModifier() { - return modifier; - } - - public void setModifier(String modifier) { - this.modifier = modifier; - } - - public String getModifyTime() { - return modifyTime; - } - - public void setModifyTime(String modifyTime) { - this.modifyTime = modifyTime; - } - - public String getMode() { - return mode; - } - - public void setMode(String mode) { - this.mode = mode; - } - - public List getChanges() { - return changes; - } - - public List getKeyChanges() { - return keyChanges; - } - - public boolean isBlocked() { - return blocked; - } - - public void setBlocked(boolean blocked) { - this.blocked = blocked; - } - - public int getExitCode() { - return exitCode; - } - - public void setExitCode(int exitCode) { - this.exitCode = exitCode; - } } diff --git a/src/main/java/com/codechecker/cache/report/KeyStructureChange.java b/src/main/java/com/codechecker/cache/report/KeyStructureChange.java index b08b7f4..f9c5c66 100644 --- a/src/main/java/com/codechecker/cache/report/KeyStructureChange.java +++ b/src/main/java/com/codechecker/cache/report/KeyStructureChange.java @@ -2,6 +2,9 @@ package com.codechecker.cache.report; import com.codechecker.cache.diff.SchemaChange; import com.codechecker.cache.diff.Severity; +import lombok.AccessLevel; +import lombok.Data; +import lombok.Setter; import java.util.ArrayList; import java.util.List; @@ -9,6 +12,7 @@ import java.util.List; /** * 按 Redis key / MQ Topic(或未知时的写入点)聚合后的结构变更摘要。 */ +@Data public class KeyStructureChange { /** 解析到的 key / destination 模式;未知时为 unknown-key */ @@ -21,56 +25,13 @@ public class KeyStructureChange { private String valueType; private boolean keyUnresolved; /** REDIS / ROCKETMQ / KAFKA */ + @Setter(AccessLevel.NONE) private String channel = "REDIS"; private String oldSkeletonJson; private String newSkeletonJson; private Severity severity = Severity.P2; private final List fieldDetails = new ArrayList<>(); - public String getKeyPattern() { - return keyPattern; - } - - public void setKeyPattern(String keyPattern) { - this.keyPattern = keyPattern; - } - - public String getKeyExpression() { - return keyExpression; - } - - public void setKeyExpression(String keyExpression) { - this.keyExpression = keyExpression; - } - - public String getWriteLocation() { - return writeLocation; - } - - public void setWriteLocation(String writeLocation) { - this.writeLocation = writeLocation; - } - - public String getValueType() { - return valueType; - } - - public void setValueType(String valueType) { - this.valueType = valueType; - } - - public boolean isKeyUnresolved() { - return keyUnresolved; - } - - public void setKeyUnresolved(boolean keyUnresolved) { - this.keyUnresolved = keyUnresolved; - } - - public String getChannel() { - return channel; - } - public void setChannel(String channel) { this.channel = channel == null || channel.isEmpty() ? "REDIS" : channel; } @@ -91,34 +52,6 @@ public class KeyStructureChange { return "Redis"; } - public String getOldSkeletonJson() { - return oldSkeletonJson; - } - - public void setOldSkeletonJson(String oldSkeletonJson) { - this.oldSkeletonJson = oldSkeletonJson; - } - - public String getNewSkeletonJson() { - return newSkeletonJson; - } - - public void setNewSkeletonJson(String newSkeletonJson) { - this.newSkeletonJson = newSkeletonJson; - } - - public Severity getSeverity() { - return severity; - } - - public void setSeverity(Severity severity) { - this.severity = severity; - } - - public List getFieldDetails() { - return fieldDetails; - } - /** * 用更严重的级别抬升当前聚合严重度(ordinal 更小者优先)。 * diff --git a/src/main/java/com/codechecker/cache/schema/FieldSchema.java b/src/main/java/com/codechecker/cache/schema/FieldSchema.java index 3893ab1..6fb2cf2 100644 --- a/src/main/java/com/codechecker/cache/schema/FieldSchema.java +++ b/src/main/java/com/codechecker/cache/schema/FieldSchema.java @@ -1,53 +1,17 @@ package com.codechecker.cache.schema; -import java.util.Objects; +import lombok.Value; /** * 扁平化后的单个字段节点。path 使用点号分隔,数组元素以 {@code []} 标记。 * 例如:{@code vo.linkList[].id}。 */ +@Value public class FieldSchema { - private final String path; - private final JsonType jsonType; - private final String javaType; - - public FieldSchema(String path, JsonType jsonType, String javaType) { - this.path = path; - this.jsonType = jsonType; - this.javaType = javaType; - } - - public String getPath() { - return path; - } - - public JsonType getJsonType() { - return jsonType; - } - - public String getJavaType() { - return javaType; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof FieldSchema)) { - return false; - } - FieldSchema that = (FieldSchema) o; - return Objects.equals(path, that.path) - && jsonType == that.jsonType - && Objects.equals(javaType, that.javaType); - } - - @Override - public int hashCode() { - return Objects.hash(path, jsonType, javaType); - } + String path; + JsonType jsonType; + String javaType; @Override public String toString() { diff --git a/src/main/java/com/codechecker/cache/schema/SourceIndex.java b/src/main/java/com/codechecker/cache/schema/SourceIndex.java index 8c34ae1..6fadbdb 100644 --- a/src/main/java/com/codechecker/cache/schema/SourceIndex.java +++ b/src/main/java/com/codechecker/cache/schema/SourceIndex.java @@ -6,6 +6,9 @@ import com.github.javaparser.ast.CompilationUnit; import com.github.javaparser.ast.ImportDeclaration; import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; import com.github.javaparser.ast.body.TypeDeclaration; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; import java.util.ArrayList; import java.util.Collection; @@ -172,33 +175,12 @@ public class SourceIndex { /** * 索引中的类型条目。 */ + @Getter + @AllArgsConstructor(access = AccessLevel.PACKAGE) public static final class IndexedType { private final ClassOrInterfaceDeclaration declaration; private final String packageName; private final List imports; private final String fqn; - - IndexedType(ClassOrInterfaceDeclaration declaration, String packageName, List imports, String fqn) { - this.declaration = declaration; - this.packageName = packageName; - this.imports = imports; - this.fqn = fqn; - } - - public ClassOrInterfaceDeclaration getDeclaration() { - return declaration; - } - - public String getPackageName() { - return packageName; - } - - public List getImports() { - return imports; - } - - public String getFqn() { - return fqn; - } } } diff --git a/src/main/java/com/codechecker/cache/schema/TypeSchema.java b/src/main/java/com/codechecker/cache/schema/TypeSchema.java index 1f63750..c513aa6 100644 --- a/src/main/java/com/codechecker/cache/schema/TypeSchema.java +++ b/src/main/java/com/codechecker/cache/schema/TypeSchema.java @@ -1,14 +1,19 @@ package com.codechecker.cache.schema; +import lombok.Getter; +import lombok.Setter; + import java.util.LinkedHashMap; import java.util.Map; /** * 某个 Redis value 类型展开后的扁平化 Schema:path -> {@link FieldSchema}。 */ +@Getter public class TypeSchema { private final String rootType; + @Setter private double confidence = 1.0; private final Map fields = new LinkedHashMap<>(); @@ -16,22 +21,6 @@ public class TypeSchema { this.rootType = rootType; } - public String getRootType() { - return rootType; - } - - public double getConfidence() { - return confidence; - } - - public void setConfidence(double confidence) { - this.confidence = confidence; - } - - public Map getFields() { - return fields; - } - /** 按字段 path 放入(同 path 后者覆盖)。 */ public void add(FieldSchema field) { fields.put(field.getPath(), field);