2 * Copyright (c) 2017 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
9 package org.opendaylight.mdsal.binding.javav2.generator.impl;
11 import com.google.common.annotations.Beta;
12 import org.opendaylight.mdsal.binding.javav2.generator.api.ClassLoadingStrategy;
13 import org.opendaylight.mdsal.binding.javav2.model.api.Type;
14 import org.opendaylight.yangtools.util.ClassLoaderUtils;
17 public abstract class GeneratedClassLoadingStrategy implements ClassLoadingStrategy {
19 private static final GeneratedClassLoadingStrategy TCCL_STRATEGY = new TCCLClassLoadingStrategy();
22 public Class<?> loadClass(final Type type) throws ClassNotFoundException {
23 return loadClass(type.getFullyQualifiedName());
27 public abstract Class<?> loadClass(String fqcn) throws ClassNotFoundException;
29 public static ClassLoadingStrategy getTCCLClassLoadingStrategy() {
33 private static final class TCCLClassLoadingStrategy extends GeneratedClassLoadingStrategy {
35 public Class<?> loadClass(final String fullyQualifiedName) throws ClassNotFoundException {
36 return ClassLoaderUtils.loadClassWithTCCL(fullyQualifiedName);