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.JavaTypeName;
17 * Runtime Context for Java YANG Binding classes. It provides information derived from the backing effective model,
18 * which is not captured in generated classes (and hence cannot be obtained from {@code BindingReflections}.
21 public final class DefaultBindingRuntimeContext extends AbstractBindingRuntimeContext {
22 private final @NonNull BindingRuntimeTypes runtimeTypes;
23 private final @NonNull ModuleInfoSnapshot moduleInfos;
25 public DefaultBindingRuntimeContext(final BindingRuntimeTypes runtimeTypes, final ModuleInfoSnapshot moduleInfos) {
26 this.runtimeTypes = requireNonNull(runtimeTypes);
27 this.moduleInfos = requireNonNull(moduleInfos);
31 public BindingRuntimeTypes getTypes() {
36 public <T> Class<T> loadClass(final JavaTypeName type) throws ClassNotFoundException {
37 return moduleInfos.loadClass(type.toString());