KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > directwebremoting > dwrp > ErrorOutboundVariable


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.dwrp;
17
18 import org.directwebremoting.extend.OutboundContext;
19 import org.directwebremoting.extend.OutboundVariable;
20
21 /**
22  * An OutboundVariable that can not be recursive.
23  * @author Joe Walker [joe at getahead dot ltd dot uk]
24  */

25 public class ErrorOutboundVariable extends AbstractOutboundVariable implements OutboundVariable
26 {
27     /**
28      * Default ctor that leaves blank (not null) members
29      * @param code the access for the inited code
30      * @param outboundContext The conversion context
31      * @param errorMessage Some message for the developer to see.
32      * @param forceInline true to force inline status, false to let the system decide
33      */

34     public ErrorOutboundVariable(OutboundContext outboundContext, String JavaDoc errorMessage, boolean forceInline)
35     {
36         super(outboundContext);
37         this.errorMessage = errorMessage;
38
39         if (forceInline)
40         {
41             forceInline(true);
42         }
43     }
44
45     /* (non-Javadoc)
46      * @see org.directwebremoting.dwrp.AbstractOutboundVariable#getNotInlineDefinition()
47      */

48     protected NotInlineDefinition getNotInlineDefinition()
49     {
50         return new NotInlineDefinition("var " + getVariableName() + "=null;", "");
51     }
52
53     /* (non-Javadoc)
54      * @see org.directwebremoting.dwrp.AbstractOutboundVariable#getInlineDefinition()
55      */

56     protected String JavaDoc getInlineDefinition()
57     {
58         return "null";
59     }
60
61     /* (non-Javadoc)
62      * @see java.lang.Object#toString()
63      */

64     public String JavaDoc toString()
65     {
66         return "Error:null";
67     }
68
69     /**
70      * A message for the developer saying what has gone wrong.
71      */

72     private String JavaDoc errorMessage;
73 }
74
Popular Tags