Class ObjectDiff.ObjectDiffBuilder<T>
java.lang.Object
cloud.opencode.base.core.bean.ObjectDiff.ObjectDiffBuilder<T>
- Type Parameters:
T- the object type | 对象类型
- Enclosing class:
ObjectDiff
Builder for advanced object diff comparison
高级对象差异比较构建器
Provides fine-grained control over the comparison process including deep recursion, depth limits, field filtering, and collection diff.
提供对比较过程的精细控制,包括深度递归、深度限制、字段过滤和集合差异。
- Since:
- JDK 25, opencode-base-core V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncollectionDiff(boolean diff) Enables or disables element-level collection diff 启用或禁用元素级别的集合差异比较compare()Executes the comparison and returns the result 执行比较并返回结果deep(boolean deep) Enables or disables deep recursive comparison 启用或禁用深度递归比较Sets the fields to exclude from comparison (blacklist) 设置要从比较中排除的字段(黑名单)Sets the fields to include in comparison (whitelist); others are excluded 设置要包含在比较中的字段(白名单);其他字段被排除maxCollectionSize(int max) Sets the maximum collection size for comparison; larger collections are marked UNCHANGED 设置比较的最大集合大小;超过限制的集合标记为 UNCHANGEDmaxDepth(int maxDepth) Sets the maximum recursion depth for deep comparison 设置深度比较的最大递归深度
-
Method Details
-
deep
Enables or disables deep recursive comparison 启用或禁用深度递归比较- Parameters:
deep- true to enable deep comparison | true 启用深度比较- Returns:
- this builder | 此构建器
-
maxDepth
Sets the maximum recursion depth for deep comparison 设置深度比较的最大递归深度- Parameters:
maxDepth- the max depth (must be positive) | 最大深度(必须为正数)- Returns:
- this builder | 此构建器
- Throws:
IllegalArgumentException- if maxDepth is not positive | 如果 maxDepth 不为正数
-
maxCollectionSize
Sets the maximum collection size for comparison; larger collections are marked UNCHANGED 设置比较的最大集合大小;超过限制的集合标记为 UNCHANGED- Parameters:
max- the max collection size (must be positive) | 最大集合大小(必须为正数)- Returns:
- this builder | 此构建器
- Throws:
IllegalArgumentException- if max is not positive | 如果 max 不为正数
-
include
Sets the fields to include in comparison (whitelist); others are excluded 设置要包含在比较中的字段(白名单);其他字段被排除- Parameters:
fields- the field names to include | 要包含的字段名称- Returns:
- this builder | 此构建器
-
exclude
Sets the fields to exclude from comparison (blacklist) 设置要从比较中排除的字段(黑名单)- Parameters:
fields- the field names to exclude | 要排除的字段名称- Returns:
- this builder | 此构建器
-
collectionDiff
Enables or disables element-level collection diff 启用或禁用元素级别的集合差异比较- Parameters:
diff- true to enable collection diff | true 启用集合差异比较- Returns:
- this builder | 此构建器
-
compare
Executes the comparison and returns the result 执行比较并返回结果- Returns:
- the diff result | 差异结果
- Throws:
OpenIllegalStateException- if max depth is exceeded during deep comparison | 深度比较时超过最大深度
-