2 * Copyright (c) 2021 PANTHEON.tech, s.r.o. 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.mdsal.binding.runtime.api;
10 import com.google.common.annotations.Beta;
11 import org.eclipse.jdt.annotation.Nullable;
12 import org.opendaylight.mdsal.binding.model.api.JavaTypeName;
13 import org.opendaylight.mdsal.binding.model.api.Type;
14 import org.opendaylight.yangtools.concepts.Immutable;
15 import org.opendaylight.yangtools.yang.common.QName;
18 * An object containing {@link RuntimeType}s.
21 public interface RuntimeTypeContainer extends Immutable {
23 * Look up a child {@link RuntimeType} by its {@code schema tree} {@link QName}. Note the returned child does not
24 * necessarily match usual data addressing rules and will resolve non-data tree statements, such as
25 * {@code notification}, {@code rpc} and {@code action}. Callers should check the traits exposed by the returned
26 * object before accepting it.
29 * One important omission is this method <b>does not</b> resolve nodes which have been added via {@code augment}
30 * statement. Those are exposed indirectly as children of {@link AugmentRuntimeType}s returned via
31 * {@link AugmentableRuntimeType#augments()}, if applicable.
33 * @param qname {@code schema node} identifier
34 * @return Corresponding {@link RuntimeType}, or null if not found
35 * @throws NullPointerException if {@code qname} is null
37 @Nullable RuntimeType schemaTreeChild(QName qname);
40 * Look up a child by the {@link JavaTypeName} of its generated class. This lookup, while very similar to
41 * {@link #schemaTreeChild(QName)}, does not precisely match the {@code schema tree} nor does it match
42 * {@code YangInstanceIdentifier} addressing.
43 * It will resolve constructs generated for {@code choice}, {@code case}, {@code notification}, {@code rpc},
44 * {@code action} and most notably for {@code grouping}, {@code identity}, {@code typedef} and {@code augment}
45 * statements. Callers should check the traits exposed by the returned object before accepting it.
47 * @param typeName Java class name of the generated class.
48 * @return Corresponding {@link RuntimeType}, or null if not found
49 * @throws NullPointerException if {@code typeName} is null
51 @Nullable GeneratedRuntimeType bindingChild(JavaTypeName typeName);
53 // FIXME: consider removing this method
54 default @Nullable RuntimeType bindingChild(final Type type) {
55 return bindingChild(type.getIdentifier());