KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > directwebremoting > extend > MarshallException


1 /*
2  * Copyright 2005 Joe Walker
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 org.directwebremoting.extend;
17
18 import org.directwebremoting.util.Messages;
19
20 /**
21  * Something has gone wrong when we were doing some conversion.
22  * @author Joe Walker [joe at getahead dot ltd dot uk]
23  */

24 public class MarshallException extends Exception JavaDoc
25 {
26     /**
27      * Default ctor
28      * @param paramType The type we were trying to marshall
29      */

30     public MarshallException(Class JavaDoc paramType)
31     {
32         super(Messages.getString("MarshallException.SimpleFailure", paramType.getName()));
33         this.paramType = paramType;
34     }
35
36     /**
37      * Construct a MarshallException with an exception and a destination type
38      * @param paramType The type we were trying to marshall
39      * @param ex error stack trace
40      */

41     public MarshallException(Class JavaDoc paramType, Throwable JavaDoc ex)
42     {
43         super(Messages.getString("MarshallException.FailureWithCause", paramType.getName(), ex.getMessage()));
44
45         this.paramType = paramType;
46         this.ex = ex;
47     }
48
49     /**
50      * Construct a MarshallException with a description message and exception
51      * @param paramType The type we were trying to marshall
52      * @param message error description
53      */

54     public MarshallException(Class JavaDoc paramType, String JavaDoc message)
55     {
56         super(Messages.getString("MarshallException.FailureWithCause", paramType.getName(), message));
57
58         this.paramType = paramType;
59     }
60
61     /**
62      * @return The cause of this exception (if any)
63      */

64     public Throwable JavaDoc getCause()
65     {
66         return ex;
67     }
68
69     /**
70      * Accessor for the type we are converting to/from
71      * @return The type we are converting to/from
72      */

73     public Class JavaDoc getConversionType()
74     {
75         return paramType;
76     }
77
78     /**
79      * The type we are converting to/from
80      */

81     private Class JavaDoc paramType;
82
83     /**
84      * Stored exception cause
85      */

86     private Throwable JavaDoc ex = null;
87 }
88
Popular Tags