1 21 package oracle.toplink.essentials.internal.parsing; 23 24 import oracle.toplink.essentials.expressions.*; 25 26 35 public class BetweenNode extends SimpleConditionalExpressionNode { 36 protected Node rightForBetween; 37 protected Node rightForAnd; 38 39 42 public BetweenNode() { 43 super(); 44 } 45 46 50 public void validate(ParseTreeContext context) { 51 Object type = null; 52 if (left != null) { 53 left.validate(context); 54 type = left.getType(); 55 } 56 if (rightForBetween != null) { 57 rightForBetween.validate(context); 58 rightForBetween.validateParameter(context, type); 59 } 60 if (rightForAnd != null) { 61 rightForAnd.validate(context); 62 rightForAnd.validateParameter(context, type); 63 } 64 TypeHelper typeHelper = context.getTypeHelper(); 65 setType(typeHelper.getBooleanType()); 66 } 67 68 73 public Expression generateExpression(GenerationContext context) { 74 Expression whereClause = getLeft().generateExpression(context); 76 77 whereClause = whereClause.between(getRightForBetween().generateExpression(context), getRightForAnd().generateExpression(context)); 79 80 return whereClause; 82 } 83 84 public Node getRightForAnd() { 85 return rightForAnd; 86 } 87 88 public Node getRightForBetween() { 89 return rightForBetween; 90 } 91 92 public boolean hasRightForAnd() { 93 return rightForAnd != null; 94 } 95 96 public boolean hasRightForBetween() { 97 return rightForBetween != null; 98 } 99 100 public void setRightForAnd(Node newRightForAnd) { 101 rightForAnd = newRightForAnd; 102 } 103 104 public void setRightForBetween(Node newRightForBetween) { 105 rightForBetween = newRightForBetween; 106 } 107 } 108 | Popular Tags |