1 2 3 package org.apache.el.parser; 4 5 import javax.el.ELException; 6 7 import org.apache.el.lang.EvaluationContext; 8 9 10 14 public final class AstLiteralExpression extends SimpleNode { 15 public AstLiteralExpression(int id) { 16 super(id); 17 } 18 19 public Class getType(EvaluationContext ctx) throws ELException { 20 return String .class; 21 } 22 23 public Object getValue(EvaluationContext ctx) throws ELException { 24 return this.image; 25 } 26 27 public void setImage(String image) { 28 if (image.indexOf('\\') == -1) { 29 this.image = image; 30 return; 31 } 32 int size = image.length(); 33 StringBuffer buf = new StringBuffer (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 |