1 /*
2 * Copyright 2006-2016 The JGUIraffe Team.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License")
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package net.sf.jguiraffe.di;
17
18 /**
19 * <p>
20 * An exception class for reporting exceptions related to dependency injection.
21 * </p>
22 * <p>
23 * When working with reflection naturally a whole bunch of exceptions can be
24 * thrown. This library wraps these exceptions in a generic
25 * <code>InjectionException</code>. Note that this is a runtime exception, so
26 * there is no need for explicit catch blocks. (If dependency injection causes
27 * exceptions, this is typically due to a wrong configuration; so there is
28 * nothing the application itself can do about.)
29 * </p>
30 *
31 * @author Oliver Heger
32 * @version $Id: InjectionException.java 205 2012-01-29 18:29:57Z oheger $
33 */
34 public class InjectionException extends RuntimeException
35 {
36 /**
37 * The serial version UID.
38 */
39 private static final long serialVersionUID = -7010018659144863407L;
40
41 /**
42 * Creates a new instance of <code>InjectionException</code>
43 */
44 public InjectionException()
45 {
46 super();
47 }
48
49 /**
50 * Creates a new instance of <code>InjectionException</code> and
51 * initializes it with an error message.
52 *
53 * @param msg the error message
54 */
55 public InjectionException(String msg)
56 {
57 super(msg);
58 }
59
60 /**
61 * Creates a new instance of <code>InjectionException</code> and
62 * initializes it with a root cause.
63 *
64 * @param cause the root cause of this exception
65 */
66 public InjectionException(Throwable cause)
67 {
68 super(cause);
69 }
70
71 /**
72 * Creates a new instance of <code>InjectionException</code> and
73 * initializes it with both an error message and a root cause.
74 *
75 * @param msg the error message
76 * @param cause the root cause of this exception
77 */
78 public InjectionException(String msg, Throwable cause)
79 {
80 super(msg, cause);
81 }
82 }