2 * Copyright (c) 2014 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.netconf.cli.commands.output;
10 import com.google.common.base.Preconditions;
11 import java.util.Collections;
12 import java.util.Iterator;
13 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
14 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
17 * The definition of output elements represented by schema nodes parsed from yang rpc definition
19 public class OutputDefinition implements Iterable<DataSchemaNode> {
21 public static final OutputDefinition EMPTY_OUTPUT = new OutputDefinition(Collections.<DataSchemaNode>emptySet());
22 private final Iterable<DataSchemaNode> childNodes;
24 public OutputDefinition(final Iterable<DataSchemaNode> childNodes) {
25 this.childNodes = childNodes;
29 public Iterator<DataSchemaNode> iterator() {
30 return childNodes.iterator();
33 public static OutputDefinition fromOutput(final ContainerSchemaNode output) {
34 Preconditions.checkNotNull(output);
35 return new OutputDefinition(output.getChildNodes());
38 public static OutputDefinition empty() {
42 public boolean isEmpty() {
43 return this == EMPTY_OUTPUT;