1 19 20 package org.apache.cayenne.exp.parser; 21 22 import java.io.PrintWriter ; 23 24 import org.apache.cayenne.exp.Expression; 25 26 32 public class ASTScalar extends SimpleNode { 33 protected Object value; 34 35 38 ASTScalar(int id) { 39 super(id); 40 } 41 42 public ASTScalar() { 43 super(ExpressionParserTreeConstants.JJTSCALAR); 44 } 45 46 public ASTScalar(Object value) { 47 super(ExpressionParserTreeConstants.JJTSCALAR); 48 setValue(value); 49 } 50 51 protected Object evaluateNode(Object o) throws Exception { 52 return value; 53 } 54 55 58 public Expression shallowCopy() { 59 ASTScalar copy = new ASTScalar(id); 60 copy.value = value; 61 return copy; 62 } 63 64 public void encodeAsString(PrintWriter pw) { 65 SimpleNode.encodeScalarAsString(pw, value); 66 } 67 68 public void setValue(Object value) { 69 this.value = value; 70 } 71 72 public Object getValue() { 73 return value; 74 } 75 76 protected String getExpressionOperator(int index) { 77 throw new UnsupportedOperationException ( 78 "No operator for '" + ExpressionParserTreeConstants.jjtNodeName[id] + "'"); 79 } 80 } 81 | Popular Tags |