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.binding.runtime.spi;
10 import com.google.common.annotations.Beta;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.binding.runtime.api.ClassLoadingStrategy;
13 import org.opendaylight.yangtools.util.ClassLoaderUtils;
16 @Deprecated(forRemoval = true)
17 public abstract class GeneratedClassLoadingStrategy implements ClassLoadingStrategy {
18 private static final class AlwaysFailClassLoadingStrategy extends GeneratedClassLoadingStrategy {
19 static final @NonNull AlwaysFailClassLoadingStrategy INSTANCE = new AlwaysFailClassLoadingStrategy();
22 public Class<?> loadClass(final String fullyQualifiedName) throws ClassNotFoundException {
23 throw new ClassNotFoundException(fullyQualifiedName);
27 private static final class TCCLClassLoadingStrategy extends GeneratedClassLoadingStrategy {
28 static final @NonNull TCCLClassLoadingStrategy INSTANCE = new TCCLClassLoadingStrategy();
31 public Class<?> loadClass(final String fullyQualifiedName) throws ClassNotFoundException {
32 return ClassLoaderUtils.loadClassWithTCCL(fullyQualifiedName);
36 protected GeneratedClassLoadingStrategy() {
40 public static final @NonNull GeneratedClassLoadingStrategy getTCCLClassLoadingStrategy() {
41 return TCCLClassLoadingStrategy.INSTANCE;
44 public static final @NonNull GeneratedClassLoadingStrategy getAlwaysFailClassLoadingStrategy() {
45 return AlwaysFailClassLoadingStrategy.INSTANCE;