KickJava   Java API By Example, From Geeks To Geeks.

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


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 SimpleOutboundVariable 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 forceInline true to force inline status, false to let the system decide
32      */

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

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

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

63     public String JavaDoc toString()
64     {
65         return "Simple:" + code;
66     }
67
68     /**
69      * The code to be executed to get the value of the initialized data
70      */

71     private String JavaDoc code;
72 }
73
Popular Tags