KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > velocity > runtime > parser > node > ASTEscape


1 package org.apache.velocity.runtime.parser.node;
2
3 /*
4  * Copyright 2000-2001,2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 import java.io.Writer JavaDoc;
20 import java.io.IOException JavaDoc;
21
22 import org.apache.velocity.context.InternalContextAdapter;
23 import org.apache.velocity.runtime.parser.Parser;
24
25 /**
26  * This class is responsible for handling Escapes
27  * in VTL.
28  *
29  * Please look at the Parser.jjt file which is
30  * what controls the generation of this class.
31  *
32  * @author <a HREF="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
33  * @version $Id: ASTEscape.java,v 1.6.4.1 2004/03/03 23:22:58 geirm Exp $
34  */

35 public class ASTEscape extends SimpleNode
36 {
37     public String JavaDoc val;
38     private char[] ctext;
39
40     public ASTEscape(int id)
41     {
42         super(id);
43     }
44     
45     public ASTEscape(Parser p, int id)
46     {
47         super(p, id);
48     }
49
50     /** Accept the visitor. **/
51     public Object JavaDoc jjtAccept(ParserVisitor visitor, Object JavaDoc data)
52     {
53         return visitor.visit(this, data);
54     }
55     
56     public Object JavaDoc init( InternalContextAdapter context, Object JavaDoc data)
57         throws Exception JavaDoc
58     {
59         ctext = val.toCharArray();
60         return data;
61     }
62
63     public boolean render( InternalContextAdapter context, Writer JavaDoc writer)
64         throws IOException JavaDoc
65     {
66         writer.write(ctext);
67         return true;
68     }
69 }
70
Popular Tags