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 java.util.Collections;
12 import org.opendaylight.controller.netconf.cli.writer.OutFormatter;
13 import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
14 import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.AugmentationNodeBaseSerializer;
15 import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.NodeSerializerDispatcher;
16 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
17 final class AugmentationNodeCliSerializer extends AugmentationNodeBaseSerializer<String> {
19 private final NodeSerializerDispatcher<String> dispatcher;
20 private final OutFormatter out;
22 AugmentationNodeCliSerializer(final OutFormatter out, final NodeSerializerDispatcher<String> dispatcher) {
23 this.out = Preconditions.checkNotNull(out);
24 this.dispatcher = Preconditions.checkNotNull(dispatcher);
28 public Iterable<String> serialize(final AugmentationSchema schema, final AugmentationNode node) {
29 final StringBuilder output = new StringBuilder();
31 out.addStringWithIndent(output, "augment");
32 out.openComposite(output);
35 for (final String childOutput : super.serialize(schema, node)) {
36 output.append(childOutput);
40 out.closeCompositeWithIndent(output);
42 return Collections.singletonList(output.toString());
46 protected NodeSerializerDispatcher<String> getNodeDispatcher() {