2 * Copyright (c) 2016 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.yangtools.yang.data.util;
10 import com.google.common.collect.ImmutableSet;
11 import java.util.ArrayList;
12 import java.util.Collection;
13 import java.util.Collections;
14 import java.util.List;
16 import javax.annotation.Nonnull;
17 import org.opendaylight.yangtools.yang.common.QName;
18 import org.opendaylight.yangtools.yang.model.api.ActionDefinition;
19 import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode;
20 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
21 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
22 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
23 import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
24 import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
25 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
26 import org.opendaylight.yangtools.yang.model.api.Status;
27 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
28 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
29 import org.opendaylight.yangtools.yang.model.api.UsesNode;
31 public final class RpcAsContainer implements ContainerSchemaNode {
33 private final RpcDefinition delegate;
36 public String getDescription() {
37 return delegate.getDescription();
41 public String getReference() {
42 return delegate.getReference();
46 public Set<TypeDefinition<?>> getTypeDefinitions() {
47 return delegate.getTypeDefinitions();
51 public Set<GroupingDefinition> getGroupings() {
52 return delegate.getGroupings();
57 public Status getStatus() {
58 return delegate.getStatus();
61 public ContainerSchemaNode getInput() {
62 return delegate.getInput();
65 public ContainerSchemaNode getOutput() {
66 return delegate.getOutput();
69 public RpcAsContainer(final RpcDefinition parentNode) {
70 delegate = parentNode;
75 public QName getQName() {
76 return delegate.getQName();
81 public SchemaPath getPath() {
82 return delegate.getPath();
87 public List<UnknownSchemaNode> getUnknownSchemaNodes() {
88 return Collections.emptyList();
92 public DataSchemaNode getDataChildByName(final QName name) {
93 // FIXME: check QNameModule
94 switch (name.getLocalName()) {
96 return delegate.getInput();
98 return delegate.getOutput();
105 public Set<UsesNode> getUses() {
106 return Collections.emptySet();
110 public Set<AugmentationSchemaNode> getAvailableAugmentations() {
111 return Collections.emptySet();
115 public boolean isPresenceContainer() {
120 public Collection<DataSchemaNode> getChildNodes() {
121 final List<DataSchemaNode> ret = new ArrayList<>();
122 final ContainerSchemaNode input = getInput();
123 final ContainerSchemaNode output = getOutput();
127 if (output != null) {
134 public boolean isAugmenting() {
139 public boolean isAddedByUses() {
144 public boolean isConfiguration() {
149 public ConstraintDefinition getConstraints() {
150 // TODO Auto-generated method stub
155 public Set<ActionDefinition> getActions() {
156 return ImmutableSet.of();