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: * JsonModeMarshallException is a hint to the conversion process that
22: * we are trying to convert in JSON mode, but we've discovered recursive data.
23: * <p>So this is officially very nasty, because we are
24: * @author Joe Walker [joe at getahead dot ltd dot uk]
25: */
26: public class JsonModeMarshallException extends RuntimeException {
27: /**
28: * Default ctor
29: * @param paramType The type we were trying to marshall
30: */
31: public JsonModeMarshallException(Class<?> paramType) {
32: super (Messages.getString("MarshallException.SimpleFailure",
33: paramType.getName()));
34: this .paramType = paramType;
35: }
36:
37: /**
38: * Construct a MarshallException with an exception and a destination type
39: * @param paramType The type we were trying to marshall
40: * @param ex error stack trace
41: */
42: public JsonModeMarshallException(Class<?> paramType, Throwable ex) {
43: super (Messages.getString("MarshallException.FailureWithCause",
44: paramType.getName(), ex.getMessage()), ex);
45: this .paramType = paramType;
46: }
47:
48: /**
49: * Construct a MarshallException with a description message and exception
50: * @param paramType The type we were trying to marshall
51: * @param message error description
52: */
53: public JsonModeMarshallException(Class<?> paramType, String message) {
54: super (Messages.getString("MarshallException.FailureWithCause",
55: paramType.getName(), message));
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: }
|