建立jb
JaversBuilder jb = JaversBuilder.javers().withMappingStyle(MappingStyle.BEAN).withListCompareAlgorithm(ListCompareAlgorithm.LEVENSHTEIN_DISTANCE).withPrettyPrint(true)
接着
log.info(diff.prettyPrint())
给
1. ListChange{globalId:'fn.dsl.diff.javers.Instance/Folder:{0F1E2D3C-4B5A-6978-8796-A5B4C3D2E1F0}', property:'permissions', containerChanges:[(3).removed:'fn.dsl.diff.javers.Permission {type: 'ALLOW', mask: '135159', GN: 'entos_users_tst@tn.fntst.ru', GT: 'GROUP', source: 'DIRECT', depth: 'THIS_OBJECT_ONLY' }', (2).'fn.dsl.diff.javers.Permission {type: 'ALLOW', mask: '999415', GN: 'entos_admins_tst@tn.fntst.ru', GT: 'GROUP', source: 'DIRECT', depth: 'THIS_OBJECT_ONLY' }' to 'fn.dsl.diff.javers.Permission {type: 'ALLOW', mask: '135159', GN: 'entos_users_tst@tn.fntst.ru', GT: 'GROUP', source: 'DIRECT', depth: 'THIS_OBJECT_ONLY' }']}
,但期望漂亮的格式。就像在文档中一样 - http://javers.org/documentation/diff-examples/#compare-valueobjects
System.out.println(diff);
//.. shouldDetectBossChange()
Diff:
1. ReferenceChange{
globalId:'org.javers.core.examples.model.Employee/Great Developer',
property:'boss',
oldRef:'org.javers.core.examples.model.Employee/Manager One',
newRef:'org.javers.core.examples.model.Employee/Manager Second'}
2. ListChange{
globalId:'org.javers.core.examples.model.Employee/Manager Second',
property:'subordinates',
containerChanges: [(0).added:'org.javers.core.examples.model.Employee/Great Developer']}
3. ListChange{
globalId:'org.javers.core.examples.model.Employee/Manager One',
property:'subordinates',
containerChanges:[(0).removed:'org.javers.core.examples.model.Employee/Great Developer']}
我做错了什么?我应该期待文档中显示的漂亮格式还是手动格式化?