final Path filePath = snapshotDir.resolve(exportSnapshot.id + "-snapshot.json");
LOG.debug("Creating JSON file : {}", filePath);
final Path filePath = snapshotDir.resolve(exportSnapshot.id + "-snapshot.json");
LOG.debug("Creating JSON file : {}", filePath);
checkState(root instanceof NormalizedNodeContainer, "Unexpected root %s", root);
writeSnapshot(filePath, (NormalizedNodeContainer<?>) root);
checkState(root instanceof NormalizedNodeContainer, "Unexpected root %s", root);
writeSnapshot(filePath, (NormalizedNodeContainer<?>) root);
try (JsonWriter jsonWriter = new JsonWriter(Files.newBufferedWriter(path))) {
jsonWriter.beginObject();
try (JsonWriter jsonWriter = new JsonWriter(Files.newBufferedWriter(path))) {
jsonWriter.beginObject();
JSONCodecFactorySupplier.RFC7951.getShared(schemaContext),
SchemaInferenceStack.of(schemaContext).toInference(), null, jsonWriter),
true)) {
JSONCodecFactorySupplier.RFC7951.getShared(schemaContext),
SchemaInferenceStack.of(schemaContext).toInference(), null, jsonWriter),
true)) {
try (JsonWriter jsonWriter = new JsonWriter(Files.newBufferedWriter(path))) {
jsonWriter.beginObject().name("Entries");
jsonWriter.beginArray();
try (JsonWriter jsonWriter = new JsonWriter(Files.newBufferedWriter(path))) {
jsonWriter.beginObject().name("Entries");
jsonWriter.beginArray();
- if (data instanceof CommitTransactionPayload) {
- final CommitTransactionPayload payload = (CommitTransactionPayload) entry.getData();
- final DataTreeCandidate candidate = payload.getCandidate().getValue().getCandidate();
+ if (data instanceof CommitTransactionPayload payload) {
+ final var candidate = payload.getCandidate().candidate();
writeNode(jsonWriter, candidate);
} else {
jsonWriter.beginObject().name("Payload").value(data.toString()).endObject();
writeNode(jsonWriter, candidate);
} else {
jsonWriter.beginObject().name("Payload").value(data.toString()).endObject();
}
private static void doWriteNode(final JsonWriter writer, final YangInstanceIdentifier path,
final DataTreeCandidateNode node) throws IOException {
}
private static void doWriteNode(final JsonWriter writer, final YangInstanceIdentifier path,
final DataTreeCandidateNode node) throws IOException {
private static void outputNodeInfo(final JsonWriter writer, final YangInstanceIdentifier path,
final DataTreeCandidateNode node) throws IOException {
private static void outputNodeInfo(final JsonWriter writer, final YangInstanceIdentifier path,
final DataTreeCandidateNode node) throws IOException {
writer.beginObject().name("Node");
writer.beginArray();
writer.beginObject().name("Path").value(path.toString()).endObject();
writer.beginObject().name("ModificationType").value(modificationType.toString()).endObject();
if (modificationType == ModificationType.WRITE) {
writer.beginObject().name("Node");
writer.beginArray();
writer.beginObject().name("Path").value(path.toString()).endObject();
writer.beginObject().name("ModificationType").value(modificationType.toString()).endObject();
if (modificationType == ModificationType.WRITE) {
writer.beginArray();
writer.beginObject().name("Path").value(path.toString()).endObject();
writer.beginObject().name("ModificationType")
writer.beginArray();
writer.beginObject().name("Path").value(path.toString()).endObject();
writer.beginObject().name("ModificationType")
- final DataTreeCandidateNode node = iterator.next();
- final YangInstanceIdentifier child = path.node(node.getIdentifier());
+ final var node = iterator.next();
+ final var child = path.node(node.name());