2 * Copyright (c) 2018 Pantheon Technologies, s.r.o. 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.mdsal.binding.runtime.api;
10 import com.google.common.annotations.Beta;
11 import java.util.Optional;
12 import org.eclipse.jdt.annotation.Nullable;
13 import org.opendaylight.mdsal.binding.model.api.JavaTypeName;
14 import org.opendaylight.yangtools.concepts.Immutable;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextProvider;
17 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
20 * The result of BindingGenerator run. Contains mapping between Types and SchemaNodes.
23 public interface BindingRuntimeTypes extends EffectiveModelContextProvider, RuntimeTypeContainer, Immutable {
25 Optional<IdentityRuntimeType> findIdentity(QName qname);
27 Optional<RuntimeType> findSchema(JavaTypeName typeName);
29 Optional<InputRuntimeType> findRpcInput(QName rpcName);
31 Optional<OutputRuntimeType> findRpcOutput(QName rpcName);
33 default @Nullable RuntimeType schemaTreeChild(final Absolute path) {
34 final var it = path.getNodeIdentifiers().iterator();
35 var tmp = schemaTreeChild(it.next());
36 while (it.hasNext() && tmp instanceof RuntimeTypeContainer) {
37 tmp = ((RuntimeTypeContainer) tmp).schemaTreeChild(it.next());