Skip to content

Commit 29a9064

Browse files
committed
Make the name of the root in RenameRootNodeFormat configurable
1 parent 1ecde7d commit 29a9064

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/main/java/org/variantsync/diffdetective/variation/diff/serialize/nodeformat/RenameRootNodeFormat.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,22 @@
99
* @author Benjamin Moosherr
1010
*/
1111
public class RenameRootNodeFormat implements DiffNodeLabelFormat {
12+
private final String rootLabel;
1213
private final DiffNodeLabelFormat inner;
1314

1415
public RenameRootNodeFormat(DiffNodeLabelFormat inner) {
16+
this(inner, "root");
17+
}
18+
19+
public RenameRootNodeFormat(DiffNodeLabelFormat inner, String rootLabel) {
20+
this.rootLabel = rootLabel;
1521
this.inner = inner;
1622
}
1723

1824
@Override
1925
public String toLabel(final DiffNode node) {
2026
if (node.isRoot()) {
21-
return "root";
27+
return rootLabel;
2228
} else {
2329
return inner.toLabel(node);
2430
}

0 commit comments

Comments
 (0)