01: /*
02: * Copyright 2005 Joe Walker
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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 {
25: /**
26: * Default ctor
27: * @param paramType The type we were trying to marshall
28: */
29: public MarshallException(Class<?> paramType) {
30: super (Messages.getString("MarshallException.SimpleFailure",
31: paramType.getName()));
32: this .paramType = paramType;
33: }
34:
35: /**
36: * Construct a MarshallException with an exception and a destination type
37: * @param paramType The type we were trying to marshall
38: * @param ex error stack trace
39: */
40: public MarshallException(Class<?> paramType, Throwable ex) {
41: super (Messages.getString("MarshallException.FailureWithCause",
42: paramType.getName(), ex.getMessage()), ex);
43:
44: this .paramType = paramType;
45: }
46:
47: /**
48: * Construct a MarshallException with a description message and exception
49: * @param paramType The type we were trying to marshall
50: * @param message error description
51: */
52: public MarshallException(Class<?> paramType, String message) {
53: super (Messages.getString("MarshallException.FailureWithCause",
54: paramType.getName(), message));
55:
56: this .paramType = paramType;
57: }
58:
59: /**
60: * Accessor for the type we are converting to/from
61: * @return The type we are converting to/from
62: */
63: public Class<?> getConversionType() {
64: return paramType;
65: }
66:
67: /**
68: * The type we are converting to/from
69: */
70: private Class<?> paramType;
71: }
|