1 23 24 package com.sun.el.parser; 25 26 import javax.el.ELException; 27 28 import com.sun.el.lang.EvaluationContext; 29 30 34 public final class AstLiteralExpression extends SimpleNode { 35 public AstLiteralExpression(int id) { 36 super(id); 37 } 38 39 public Class getType(EvaluationContext ctx) throws ELException { 40 return String .class; 41 } 42 43 public Object getValue(EvaluationContext ctx) throws ELException { 44 return this.image; 45 } 46 47 public void setImage(String image) { 48 if (image.indexOf('\\') == -1) { 49 this.image = image; 50 return; 51 } 52 int size = image.length(); 53 StringBuffer buf = new StringBuffer (size); 54 for (int i = 0; i < size; i++) { 55 char c = image.charAt(i); 56 if (c == '\\' && i + 1 < size) { 57 char c1 = image.charAt(i + 1); 58 if (c1 == '\\' || c1 == '"' || c1 == '\'' || c1 == '#' 59 || c1 == '$') { 60 c = c1; 61 i++; 62 } 63 } 64 buf.append(c); 65 } 66 this.image = buf.toString(); 67 } 68 } 69 | Popular Tags |