1 30 package com.genimen.djeneric.tools.scriptengine.core.nodes; 31 32 import java.util.HashMap ; 33 34 import com.genimen.djeneric.tools.scriptengine.core.DjScriptParserEngine; 35 import com.genimen.djeneric.tools.scriptengine.core.SimpleNode; 36 import com.genimen.djeneric.tools.scriptengine.core.util.DjScriptCompileTimeScope; 37 import com.genimen.djeneric.tools.scriptengine.core.util.DjScriptExecutionTimeScope; 38 39 public class CharNode extends SimpleNode implements ValueExpression 40 { 41 String _value; 42 43 public CharNode(int i) 44 { 45 super(i); 46 } 47 48 public CharNode(DjScriptParserEngine p, int i) 49 { 50 super(p, i); 51 } 52 53 public String getName() 54 { 55 return toString(); 56 } 57 58 public String toString() 59 { 60 return _value; 61 } 62 63 public Object getValue(DjScriptExecutionTimeScope context) 64 { 65 return _value; 66 } 67 68 public void setValue(String v) 69 { v = v.substring(1); 71 v = v.substring(0, v.length() - 1); 72 73 _value = String.valueOf(StringNode.translateEscapes(v).charAt(0)); 74 } 75 76 public void translateOql(DjScriptExecutionTimeScope ctxt, StringBuffer result, HashMap parameters) 77 { 78 result.append("'"); 79 result.append(_value); 80 result.append("'"); 81 } 82 83 public String getValidatedTypeName(DjScriptCompileTimeScope context) 84 { 85 return String .class.getName(); 86 } 87 88 } | Popular Tags |