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 javax.annotation.Nonnull;
13 import javax.annotation.Nullable;
16 * Thrown where incorrect nesting of data structures was detected
17 * and was caused by user.
20 class IncorrectNestingException extends IllegalArgumentException {
22 private static final long serialVersionUID = 1L;
24 protected IncorrectNestingException(final String message) {
28 public static IncorrectNestingException create(final String message, final Object... args) {
29 return new IncorrectNestingException(String.format(message, args));
32 public static void check(final boolean check, final String message, final Object... args) {
34 throw IncorrectNestingException.create(message, args);
39 public static <V> V checkNonNull(@Nullable final V nullable, final String message, final Object... args) {
40 if (nullable != null) {
43 throw IncorrectNestingException.create(message, args);