01: /* Generated By:JJTree: Do not edit this line. AstLiteralExpression.java */
02:
03: package org.apache.el.parser;
04:
05: import javax.el.ELException;
06:
07: import org.apache.el.lang.EvaluationContext;
08:
09: /**
10: * @author Jacob Hookom [jacob@hookom.net]
11: * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: markt $
12: */
13: public final class AstLiteralExpression extends SimpleNode {
14: public AstLiteralExpression(int id) {
15: super (id);
16: }
17:
18: public Class getType(EvaluationContext ctx) throws ELException {
19: return String.class;
20: }
21:
22: public Object getValue(EvaluationContext ctx) throws ELException {
23: return this .image;
24: }
25:
26: public void setImage(String image) {
27: if (image.indexOf('\\') == -1) {
28: this .image = image;
29: return;
30: }
31: int size = image.length();
32: StringBuffer buf = new StringBuffer(size);
33: for (int i = 0; i < size; i++) {
34: char c = image.charAt(i);
35: if (c == '\\' && i + 1 < size) {
36: char c1 = image.charAt(i + 1);
37: if (c1 == '\\' || c1 == '"' || c1 == '\'' || c1 == '#'
38: || c1 == '$') {
39: c = c1;
40: i++;
41: }
42: }
43: buf.append(c);
44: }
45: this.image = buf.toString();
46: }
47: }
|