2 * Copyright (c) 2013 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
8 package org.opendaylight.controller.netconf.cli.writer.impl;
10 import com.google.common.base.Preconditions;
11 import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
12 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
13 import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.LeafNodeBaseSerializer;
14 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
16 final class LeafNodeCliSerializer extends LeafNodeBaseSerializer<String> {
17 private final OutFormatter out;
19 LeafNodeCliSerializer(final OutFormatter out) {
20 this.out = Preconditions.checkNotNull(out);
24 public String serializeLeaf(final LeafSchemaNode schema, final LeafNode<?> node) {
25 final StringBuilder output = new StringBuilder();
27 out.addStringWithIndent(output, node.getNodeType().getLocalName());
29 output.append(node.getValue());
31 return output.toString();