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.controller.netconf.cli.commands.output;
10 import com.google.common.base.Preconditions;
11 import java.util.Collections;
12 import java.util.Iterator;
14 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
15 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
18 * The definition of output elements represented by schema nodes parsed from yang rpc definition
20 public class OutputDefinition implements Iterable<DataSchemaNode> {
22 public static final OutputDefinition EMPTY_OUTPUT = new OutputDefinition(Collections.<DataSchemaNode>emptySet());
23 private final Set<DataSchemaNode> childNodes;
25 public OutputDefinition(final Set<DataSchemaNode> childNodes) {
26 this.childNodes = childNodes;
30 public Iterator<DataSchemaNode> iterator() {
31 return childNodes.iterator();
34 public static OutputDefinition fromOutput(final ContainerSchemaNode output) {
35 Preconditions.checkNotNull(output);
36 return new OutputDefinition(output.getChildNodes());
39 public static OutputDefinition empty() {
43 public boolean isEmpty() {
44 return this == EMPTY_OUTPUT;