2 * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.dom.codec.impl.context.base;
11 import com.google.common.annotations.Beta;
12 import org.opendaylight.mdsal.binding.javav2.dom.codec.impl.MissingSchemaException;
13 import org.opendaylight.mdsal.binding.javav2.generator.api.ClassLoadingStrategy;
16 * Thrown when user schema for supplied binding class is available in present schema context, but
17 * binding class itself is not known to codecs because backing class loading strategy did not
21 public class MissingClassInLoadingStrategyException extends MissingSchemaException {
23 private static final long serialVersionUID = 1L;
25 protected MissingClassInLoadingStrategyException(final String msg, final Throwable cause) {
29 public static void check(final ClassLoadingStrategy strategy, final Class<?> childClass) {
31 strategy.loadClass(childClass.getName());
32 } catch (final ClassNotFoundException e) {
33 final String message =
34 String.format("User supplied class %s is not available in %s.", childClass.getName(), strategy);
35 throw new MissingClassInLoadingStrategyException(message, e);