1 21 package oracle.toplink.essentials.internal.parsing; 23 24 import oracle.toplink.essentials.queryframework.ObjectLevelReadQuery; 25 import oracle.toplink.essentials.queryframework.ReportQuery; 26 27 import oracle.toplink.essentials.expressions.*; 28 import oracle.toplink.essentials.internal.expressions.*; 29 30 41 public class LiteralNode extends Node { 42 public java.lang.Object literal; 43 44 47 public LiteralNode() { 48 super(); 49 } 50 51 55 public void applyToQuery(ObjectLevelReadQuery theQuery, GenerationContext context) { 56 if (theQuery.isReportQuery()) { 57 ReportQuery reportQuery = (ReportQuery)theQuery; 58 reportQuery.addAttribute("CONSTANT", generateExpression(context)); 59 } 60 61 } 62 63 67 public Expression generateExpression(GenerationContext context) { 68 Expression whereClause = new ConstantExpression(getLiteral(), new ExpressionBuilder()); 69 return whereClause; 70 } 71 72 76 public String getAsString() { 77 return getLiteral().toString(); 78 } 79 80 85 public java.lang.Object getLiteral() { 86 return literal; 87 } 88 89 93 public boolean isLiteralNode() { 94 return true; 95 } 96 97 102 public void setLiteral(java.lang.Object newLiteral) { 103 literal = newLiteral; 104 } 105 106 public String toString(int indent) { 107 StringBuffer buffer = new StringBuffer (); 108 toStringIndent(indent, buffer); 109 buffer.append(toStringDisplayName() + "[" + getLiteral() + "]"); 110 return buffer.toString(); 111 } 112 } 113 | Popular Tags |