57 lines
1.3 KiB
Java
57 lines
1.3 KiB
Java
package com.codechecker.cache.schema;
|
|
|
|
import java.util.Objects;
|
|
|
|
/**
|
|
* 扁平化后的单个字段节点。path 使用点号分隔,数组元素以 {@code []} 标记。
|
|
* 例如:{@code vo.linkList[].id}。
|
|
*/
|
|
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);
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return path + ":" + jsonType + "(" + javaType + ")";
|
|
}
|
|
}
|