01: /* Generated By:JJTree: Do not edit this line. AstString.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 AstString extends SimpleNode {
14: public AstString(int id) {
15: super (id);
16: }
17:
18: private String string;
19:
20: public String getString() {
21: if (this .string == null) {
22: this .string = this .image.substring(1,
23: this .image.length() - 1);
24: }
25: return this .string;
26: }
27:
28: public Class getType(EvaluationContext ctx) throws ELException {
29: return String.class;
30: }
31:
32: public Object getValue(EvaluationContext ctx) throws ELException {
33: return this .getString();
34: }
35:
36: public void setImage(String image) {
37: if (image.indexOf('\\') == -1) {
38: this .image = image;
39: return;
40: }
41: int size = image.length();
42: StringBuffer buf = new StringBuffer(size);
43: for (int i = 0; i < size; i++) {
44: char c = image.charAt(i);
45: if (c == '\\' && i + 1 < size) {
46: char c1 = image.charAt(i + 1);
47: if (c1 == '\\' || c1 == '"' || c1 == '\'' || c1 == '#'
48: || c1 == '$') {
49: c = c1;
50: i++;
51: }
52: }
53: buf.append(c);
54: }
55: this.image = buf.toString();
56: }
57: }
|