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