/** * Translates query qualifier to SQL WHERE clause. Qualifier is a method * parameter. * * @since 3.0 */ protected void doAppendPart(Expression rootNode) { if (rootNode == null) { return; } rootNode.traverse(this); }
/** * Traverses itself and child expressions, notifying visitor via callback methods as * it goes. This is an Expression-specific implementation of the "Visitor" design * pattern. * * @since 1.1 */ public void traverse(TraversalHandler visitor) { if (visitor == null) { throw new NullPointerException("Null Visitor."); } traverse(null, visitor); }
/** * Traverses itself and child expressions, notifying visitor via callback * methods as it goes. This is an Expression-specific implementation of the * "Visitor" design pattern. * * @since 1.1 */ public void traverse(TraversalHandler visitor) { if (visitor == null) { throw new NullPointerException("Null Visitor."); } traverse(null, visitor); }
private void testExpression(Entity rootEntity, Expression exp) throws ExpressionException { if (exp != null) { exp.traverse(new EntityExpressionValidator(rootEntity)); } }
private boolean isAggregate(Property<?> property) { final boolean[] isAggregate = new boolean[1]; Expression exp = property.getExpression(); exp.traverse(new TraversalHelper() { @Override public void startNode(Expression node, Expression parentNode) { if(node instanceof ASTAggregateFunctionCall) { isAggregate[0] = true; } } }); return isAggregate[0]; }
/** Translates query qualifier to SQL WHERE clause. * Qualifier is obtained from <code>queryAssembler</code> object. */ public String doTranslation() { qualBuf.setLength(0); Expression rootNode = extractQualifier(); if (rootNode == null) { return null; } // build SQL where clause string based on expression // (using '?' for object values) rootNode.traverse(this); return qualBuf.length() > 0 ? qualBuf.toString() : null; }
@Override protected void doAppendPart(Expression rootNode) { if (rootNode == null) { return; } rootNode = rootNode.transform(new INTrimmer()); rootNode.traverse(this); }
/** * Produces a chain of ASTNodes, returning the starting node that can be used * to evaluate expressions. */ static ASTNode compile(Expression expression) throws ExpressionException { ExpressionParser handler = new ExpressionParser(); expression.traverse(handler); return handler.finishParsing(expression); }
@Override protected void doAppendPart(Expression rootNode) { if (rootNode == null) { return; } // IN statements with more than 1500 values are denied in Firebird // so we need to split one big statement on few smaller ones rootNode = rootNode.transform(new OracleQualifierTranslator.INTrimmer()); rootNode.traverse(this); }
/** * @since 4.0 */ void inPlaceParamsArray(Object... parameters) { InPlaceParamReplacer replacer = new InPlaceParamReplacer(parameters == null ? new Object[0] : parameters); traverse(replacer); replacer.onFinish(); }
private Expression validateAndCleanup(AgEntity<?> entity, Expression exp) { // change expression in-place // note - this will not fully handle an expression whose root is // ASTObjPath, so will manually process it below exp.traverse(getOrCreateExpressionProcessor(entity)); // process root ASTObjPath that can't be properly handled by // 'expressionPostProcessor'. If it happens to be "id", it will be // converted to "db:id". if (exp instanceof ASTObjPath) { exp = pathCache.getPathDescriptor(entity, (ASTObjPath) exp).getPathExp(); } return exp; }
final DbEntity dbEntity = descriptor.getEntity().getDbEntity(); qualifier.traverse(new TraversalHelper() {
/** * Traverses itself and child expressions, notifying visitor via callback methods as * it goes. * * @since 1.1 */ protected void traverse(Expression parentExp, TraversalHandler visitor) { visitor.startNode(this, parentExp); // recursively traverse each child int count = getOperandCount(); for (int i = 0; i < count; i++) { Object child = getOperand(i); if (child instanceof Expression) { Expression childExp = (Expression) child; childExp.traverse(this, visitor); } else { visitor.objectNode(child, this); } visitor.finishedChild(this, i, i < count - 1); } visitor.endNode(this, parentExp); }
/** * Traverses itself and child expressions, notifying visitor via callback * methods as it goes. * * @since 1.1 */ protected void traverse(Expression parentExp, TraversalHandler visitor) { visitor.startNode(this, parentExp); // recursively traverse each child int count = getOperandCount(); for (int i = 0; i < count; i++) { Object child = getOperand(i); if (child instanceof Expression && !(child instanceof ASTScalar)) { Expression childExp = (Expression) child; childExp.traverse(this, visitor); } else { visitor.objectNode(child, this); } visitor.finishedChild(this, i, i < count - 1); } visitor.endNode(this, parentExp); }