2 * Copyright (c) 2015 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.yangtools.binding.data.codec.impl;
10 import javax.annotation.Nonnull;
11 import javax.annotation.Nullable;
15 * Thrown where incorrect nesting of data structures was detected
16 * and was caused by user.
19 public class IncorrectNestingException extends IllegalArgumentException {
21 private static final long serialVersionUID = 1L;
23 protected IncorrectNestingException(final String message) {
27 public static IncorrectNestingException create(final String message, final Object... args) {
28 return new IncorrectNestingException(String.format(message, args));
31 public static void check(final boolean check, final String message, final Object... args) {
33 throw IncorrectNestingException.create(message, args);
38 public static <V> V checkNonNull(@Nullable final V nullable, final String message, final Object... args) {
39 if(nullable != null) {
42 throw IncorrectNestingException.create(message, args);