KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cayenne > CayenneRuntimeException


1 /*****************************************************************
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. 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,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  ****************************************************************/

19
20 package org.apache.cayenne;
21
22 /**
23  * A generic unchecked exception that may be thrown by Cayenne framework. All runtime
24  * exceptions in Cayenne inherit from this class.
25  *
26  * @author Andrus Adamchik
27  */

28 public class CayenneRuntimeException extends RuntimeException JavaDoc {
29
30     /**
31      * Creates new CayenneRuntimeException without detail message.
32      */

33     public CayenneRuntimeException() {
34     }
35
36     /**
37      * Constructs an <code>CayenneRuntimeException</code> with the specified detail
38      * message.
39      *
40      * @param message the detail message.
41      */

42     public CayenneRuntimeException(String JavaDoc message) {
43         super(message);
44     }
45
46     /**
47      * Constructs an <code>CayenneRuntimeException</code> that wraps
48      * <code>exception</code> thrown elsewhere.
49      */

50     public CayenneRuntimeException(Throwable JavaDoc cause) {
51         super(cause);
52     }
53
54     public CayenneRuntimeException(String JavaDoc message, Throwable JavaDoc cause) {
55         super(message, cause);
56     }
57
58     /**
59      * Returns exception message without Cayenne version label.
60      *
61      * @since 1.1
62      */

63     public String JavaDoc getUnlabeledMessage() {
64         return super.getMessage();
65     }
66
67     /**
68      * Returns message that includes Cayenne version label and the actual exception
69      * message.
70      */

71     public String JavaDoc getMessage() {
72         String JavaDoc message = super.getMessage();
73         return (message != null)
74                 ? CayenneException.getExceptionLabel() + message
75                 : CayenneException.getExceptionLabel() + "(no message)";
76     }
77 }
78
Popular Tags