View Javadoc

1   package net.sf.tomp.xtcl.command;
2   
3   import net.sf.tomp.xtcl.Context;
4   
5   /***
6    * Creates a String and puts it as variable to Context.
7    * 
8    * @author tomp
9    */
10  public class Str extends VarCommand {
11  	
12      /*** the String content */
13      protected String value;
14  
15      /***
16       * set the String content
17       * 
18       * @param v the String content
19       */
20      public void setValue(String v) {
21          value = v;
22      }
23  
24      /***
25       * Creates a String and puts it as variable to Context.
26       */
27      public int execute(Context context) throws Exception {
28  
29      	context.put(var, (value == null) ? "" : value);
30          return done(context, 0);
31      }
32  
33      /***
34       * @return "STRING " + var + "='" + value + "'";
35       */
36      public String toString() {
37          return "STRING " + var + "='" + value + "'";
38      }
39  }
40  
41  /*
42   * The contents of this file are subject to the Mozilla Public License Version
43   * 1.1 (the "License"); you may not use this file except in compliance with the
44   * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
45   * Software distributed under the License is distributed on an "AS IS" basis,
46   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
47   * the specific language governing rights and limitations under the License. The
48   * Original Code is: all this file. The Initial Developer of the Original Code
49   * is: Tomas Pitner, Masaryk University in Brno, Czech Republic. Contributor(s):
50   */