2 * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.cluster.datastore.node.utils;
11 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
12 import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
13 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
15 public class NormalizedNodePrinter implements NormalizedNodeVisitor {
17 private String spaces(int n){
18 StringBuilder builder = new StringBuilder();
22 return builder.toString();
26 public void visitNode(int level, String parentPath, NormalizedNode<?, ?> normalizedNode) {
27 System.out.println(spaces((level) * 4) + normalizedNode.getClass().toString() + ":" + normalizedNode.getIdentifier());
28 if(normalizedNode instanceof LeafNode || normalizedNode instanceof LeafSetEntryNode){
29 System.out.println(spaces((level) * 4) + " parentPath = " + parentPath);
30 System.out.println(spaces((level) * 4) + " key = " + normalizedNode.getClass().toString() + ":" + normalizedNode.getIdentifier());
31 System.out.println(spaces((level) * 4) + " value = " + normalizedNode.getValue());