Improve NormalizedNode formatting capabilities 59/95459/30
authorKonstantin.Nosach <Kostiantyn.Nosach@pantheon.tech>
Fri, 12 Feb 2021 12:31:57 +0000 (14:31 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Sun, 25 Apr 2021 07:46:54 +0000 (09:46 +0200)
commitbe5dd6ce039a63a8e14f1d7dd2320f49f4aa83d6
tree556c4982172c47aad5e8076a3382fab9a76d3424
parent741f82fd1d5f27cc878a27bb4d055c25ae57498e
Improve NormalizedNode formatting capabilities

Add NormalizedNode.prettyTree(), which acts as a conduit to a
human-readable String representing the tree. The tree is hidden behind a
toString()/Supplier<String>, so it is usable with logging.

Since this is a generally-useful concept, which can span different kinds
of structures, capture it as PrettyTree/PrettyTreeAware as well.

JIRA: YANGTOOLS-1203
Change-Id: I6f2c98bc3048a086063846699ec73e0f2ac02b33
Signed-off-by: Kostiantyn Nosach <kostiantyn.nosach@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 files changed:
common/concepts/src/main/java/org/opendaylight/yangtools/concepts/PrettyTree.java [new file with mode: 0644]
common/concepts/src/main/java/org/opendaylight/yangtools/concepts/PrettyTreeAware.java [new file with mode: 0644]
common/concepts/src/main/java/org/opendaylight/yangtools/concepts/PrettyTreeIndent.java [new file with mode: 0644]
data/yang-data-spi/src/main/java/module-info.java
data/yang-data-spi/src/main/java/org/opendaylight/yangtools/yang/data/spi/node/AbstractNormalizedNode.java
data/yang-data-spi/src/main/java/org/opendaylight/yangtools/yang/data/spi/node/NormalizedNodePrettyTree.java [new file with mode: 0644]
yang/rfc8528-data-util/pom.xml
yang/rfc8528-data-util/src/main/java/module-info.java
yang/rfc8528-data-util/src/main/java/org/opendaylight/yangtools/rfc8528/data/util/ImmutableMountPointNode.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/NormalizedNode.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/AbstractPrettyTreeTest.java [new file with mode: 0644]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/NormalizedNodePrettyTreeTest.java [new file with mode: 0644]
yang/yang-data-impl/src/test/resources/pretty-print/another.yang [new file with mode: 0644]
yang/yang-data-impl/src/test/resources/pretty-print/test.yang [new file with mode: 0644]