Record Class DiffEntry
java.lang.Object
java.lang.Record
cloud.opencode.base.xml.diff.DiffEntry
- Record Components:
path- the XPath-like path to the differing element | 差异元素的类 XPath 路径type- the type of difference | 差异类型oldValue- the old value (from first document), null if added | 旧值(来自第一个文档),如果是新增则为 nullnewValue- the new value (from second document), null if removed | 新值(来自第二个文档),如果是删除则为 null
public record DiffEntry(String path, DiffType type, String oldValue, String newValue)
extends Record
Diff Entry - A single difference between two XML documents
差异条目 - 两个 XML 文档之间的单个差异
Represents one specific difference found during XML comparison, including the XPath-like path, the type of change, and old/new values.
表示在 XML 比较期间发现的一个具体差异,包括类 XPath 路径、变更类型和旧值/新值。
Features | 主要功能:
- Immutable record with path, type, old/new values - 包含路径、类型、旧值/新值的不可变记录
- XPath-like path format: /root/child[0]/grandchild[1] - 类 XPath 路径格式
Usage Examples | 使用示例:
DiffEntry entry = new DiffEntry("/root/item[0]", DiffType.ADDED, null, "new value");
System.out.println(entry.path()); // "/root/item[0]"
System.out.println(entry.type()); // ADDED
Security | 安全性:
- Thread-safe: Yes (immutable record) - 线程安全: 是(不可变记录)
- Null-safe: Allows null for oldValue/newValue - 空值安全: 允许 oldValue/newValue 为 null
- Since:
- JDK 25, opencode-base-xml V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.newValue()Returns the value of thenewValuerecord component.oldValue()Returns the value of theoldValuerecord component.path()Returns the value of thepathrecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Constructor Details
-
DiffEntry
-
-
Method Details
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
path
-
type
-
oldValue
-
newValue
-