java - 是否支持使用 java 库“javers”比较功能对 SortedSet 进行更改?
问题描述
具有 SortedSet 类型字段的类不会显示在更改中。
class TestClass{
String id;
Set<String> set;
SortedSet<String> sortedSet;
}
private void runTest(){
Javers javers = JaversBuilder
.javers()
.withListCompareAlgorithm(ListCompareAlgorithm.LEVENSHTEIN_DISTANCE)
.registerEntity(new EntityDefinition(TestClass.class, "id"))
.build();
TestClass tc1 = new TestClass();
tc1.id = "1";
tc1.set = new HashSet<>(Collections.singletonList("StringInSet1"));
tc1.sortedSet = new TreeSet<>(Collections.singletonList("StringInSortedSet1"));
TestClass tc2 = new TestClass();
tc2.id = "1";
tc2.set = new HashSet<>(Collections.singletonList("StringInSet2"));
tc2.sortedSet = new TreeSet<>(Collections.singletonList("StringInSortedSet2"));
Diff diff = javers.compare(tc1, tc2);
System.out.println(diff.changesSummary());
}
实际结果:更改 - SetChange:1 预期结果:更改 - SetChange:2
解决方案
在https://github.com/javers/javers/issues/888中修复:
修复了当属性类型是基本可枚举类型(例如,SortedMap、SortedSet 等)的子类型时生成更改的回归
推荐阅读
- google-bigquery - 将字符串数据从 Bigquery 导出到不带双引号的 GCS (CSV)
- django - 如何渲染元素取决于所选选项?
- python - Python:使用 IF 语句从字典到列表
- visual-studio-code - Visual Studio Code Remote SSH 使用 Windows 用户名而不是 ssh_config 中的用户名
- html - 如何在没有框架的 PWA 中实现暗模式?
- python - 对于线长的(x,y)像素坐标,调整角度变成圆形
- javascript - 字符串类型的 Mongoose _id 不抛出错误
- c# - ASP.NET 应用程序运行时如何将数据保存在内存(会话)中?
- ios - 如果集合中只有 1 个元素,则 UICollectionView 不进入 cellForItemAt 方法
- azure - 将自定义 exe 上传到 Azure Devops 管道