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.mdsal.binding.runtime.api;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.annotations.Beta;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.opendaylight.mdsal.binding.model.api.Type;
15 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
18 * Runtime Context for Java YANG Binding classes. It provides information derived from the backing effective model,
19 * which is not captured in generated classes (and hence cannot be obtained from {@code BindingReflections}.
21 * <p>Some of this information are for example list of all available children for cases
22 * {@link #getChoiceCaseChildren(DataNodeContainer)}, since choices are augmentable and new choices may be introduced
23 * by additional models. Same goes for all possible augmentations.
26 public final class DefaultBindingRuntimeContext extends AbstractBindingRuntimeContext {
27 private final @NonNull BindingRuntimeTypes runtimeTypes;
28 private final @NonNull ModuleInfoSnapshot moduleInfos;
30 public DefaultBindingRuntimeContext(final BindingRuntimeTypes runtimeTypes, final ModuleInfoSnapshot moduleInfos) {
31 this.runtimeTypes = requireNonNull(runtimeTypes);
32 this.moduleInfos = requireNonNull(moduleInfos);
36 public BindingRuntimeTypes getTypes() {
41 public <T> Class<T> loadClass(Type type) throws ClassNotFoundException {
42 return moduleInfos.loadClass(type.getFullyQualifiedName());