KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > el > parser > AstLiteralExpression


1 /* Generated By:JJTree: Do not edit this line. AstLiteralExpression.java */
2
3 package org.apache.el.parser;
4
5 import javax.el.ELException;
6
7 import org.apache.el.lang.EvaluationContext;
8
9
10 /**
11  * @author Jacob Hookom [jacob@hookom.net]
12  * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: markt $
13  */

14 public final class AstLiteralExpression extends SimpleNode {
15     public AstLiteralExpression(int id) {
16         super(id);
17     }
18
19     public Class JavaDoc getType(EvaluationContext ctx) throws ELException {
20         return String JavaDoc.class;
21     }
22
23     public Object JavaDoc getValue(EvaluationContext ctx) throws ELException {
24         return this.image;
25     }
26
27     public void setImage(String JavaDoc image) {
28         if (image.indexOf('\\') == -1) {
29             this.image = image;
30             return;
31         }
32         int size = image.length();
33         StringBuffer JavaDoc buf = new StringBuffer JavaDoc(size);
34         for (int i = 0; i < size; i++) {
35             char c = image.charAt(i);
36             if (c == '\\' && i + 1 < size) {
37                 char c1 = image.charAt(i + 1);
38                 if (c1 == '\\' || c1 == '"' || c1 == '\'' || c1 == '#'
39                         || c1 == '$') {
40                     c = c1;
41                     i++;
42                 }
43             }
44             buf.append(c);
45         }
46         this.image = buf.toString();
47     }
48 }
49
Popular Tags