KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > directwebremoting > convert > MinimalistExceptionConverter


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.convert;
17
18 import java.util.HashMap JavaDoc;
19 import java.util.Map JavaDoc;
20
21 import org.directwebremoting.extend.MarshallException;
22
23 /**
24  * A special case of BeanConverter for use by default with {@link Throwable}s,
25  * which only outputs a "broken" message.
26  * <p>In other words, by default the user doesn't get to learn anything about
27  * failures on the server.
28  * @author Joe Walker [joe at getahead dot ltd dot uk]
29  */

30 public class MinimalistExceptionConverter extends BeanConverter
31 {
32     /* (non-Javadoc)
33      * @see org.directwebremoting.convert.BasicBeanConverter#getPropertyDescriptors(java.lang.Class, boolean, boolean)
34      */

35     public Map JavaDoc getPropertyMapFromClass(Class JavaDoc type, boolean readRequired, boolean writeRequired) throws MarshallException
36     {
37         Map JavaDoc descriptors = new HashMap JavaDoc();
38
39         descriptors.put("message", new PlainProperty("message", "Error"));
40         descriptors.put("javaClassName", new PlainProperty("javaClassName", "java.lang.Throwable"));
41
42         return descriptors;
43     }
44 }
45
Popular Tags