Search in sources :

Example 6 with ArgumentListFunctionExpression

use of org.eclipse.persistence.internal.expressions.ArgumentListFunctionExpression in project eclipselink by eclipse-ee4j.

the class CriteriaBuilderImpl method coalesce.

/**
 * Create an expression that returns null if all its arguments evaluate to
 * null, and the value of the first non-null argument otherwise.
 *
 * @param x
 *            expression
 * @param y
 *            value
 * @return coalesce expression
 */
@Override
public <Y> Expression<Y> coalesce(Expression<? extends Y> x, Y y) {
    ArgumentListFunctionExpression coalesce = ((InternalSelection) x).getCurrentNode().coalesce();
    org.eclipse.persistence.expressions.Expression expX = ((InternalSelection) x).getCurrentNode();
    expX = org.eclipse.persistence.expressions.Expression.from(expX, coalesce);
    coalesce.addChild(expX);
    org.eclipse.persistence.expressions.Expression expY = org.eclipse.persistence.expressions.Expression.from(y, new ExpressionBuilder());
    coalesce.addChild(expY);
    return new CoalesceImpl(metamodel, x.getJavaType(), coalesce, buildList(x, internalLiteral(y)), "coalesce");
}
Also used : ArgumentListFunctionExpression(org.eclipse.persistence.internal.expressions.ArgumentListFunctionExpression) ExpressionBuilder(org.eclipse.persistence.expressions.ExpressionBuilder)

Aggregations

ArgumentListFunctionExpression (org.eclipse.persistence.internal.expressions.ArgumentListFunctionExpression)6 Iterator (java.util.Iterator)1 ExpressionBuilder (org.eclipse.persistence.expressions.ExpressionBuilder)1 BaseExpression (org.eclipse.persistence.internal.expressions.BaseExpression)1 CollectionExpression (org.eclipse.persistence.internal.expressions.CollectionExpression)1 ConstantExpression (org.eclipse.persistence.internal.expressions.ConstantExpression)1 ExpressionIterator (org.eclipse.persistence.internal.expressions.ExpressionIterator)1 FunctionExpression (org.eclipse.persistence.internal.expressions.FunctionExpression)1 LiteralExpression (org.eclipse.persistence.internal.expressions.LiteralExpression)1 MapEntryExpression (org.eclipse.persistence.internal.expressions.MapEntryExpression)1 ParameterExpression (org.eclipse.persistence.internal.expressions.ParameterExpression)1 SubSelectExpression (org.eclipse.persistence.internal.expressions.SubSelectExpression)1