1 /*
2 * AutoDAO - Generic DAO on steroids implementation for Java.
3 *
4 * Copyright 2008-2012 Marat Radchenko <slonopotamus@users.sourceforge.net>
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 package net.sf.autodao.impl;
19
20 import java.lang.reflect.Method;
21
22 import org.jetbrains.annotations.Nullable;
23
24 /**
25 * Exception that is thrown when AutoDAO interface violates any rules. This exception indicates programming error, it
26 * should never be caught.
27 *
28 * <p>NOT FOR PUBLIC USE.
29 */
30 public final class SpecificationViolationException extends RuntimeException {
31
32 private static final long serialVersionUID = 42;
33
34 /**
35 * Constructor.
36 *
37 * @param message error message.
38 * @param meth invalid method.
39 */
40 public SpecificationViolationException(final String message, final Method meth) {
41 this(message, meth, null);
42 }
43
44 public SpecificationViolationException(final String message, final Method meth, @Nullable final Throwable cause) {
45 super("AutoDAO specification violation in " + meth + ": " + message, cause);
46 }
47 }