org.eclipse.persistence.jpa.jpql.parser.AllOrAnyExpression Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of eclipselink Show documentation
Show all versions of eclipselink Show documentation
EclipseLink build based upon Git transaction f2b9fc5
/*
* Copyright (c) 2006, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0,
* or the Eclipse Distribution License v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
// Contributors:
// Oracle - initial API and implementation
//
package org.eclipse.persistence.jpa.jpql.parser;
import org.eclipse.persistence.jpa.jpql.WordParser;
/**
* An ALL conditional expression is a predicate that is true
if the comparison
* operation is true
for all values in the result of the subquery or the result of the
* subquery is empty. An ALL conditional expression is false
if the result of
* the comparison is false
for at least one row, and is unknown if neither
* true
nor false
.
*
* An ANY conditional expression is a predicate that is true
if the comparison
* operation is true
for some value in the result of the subquery. An ANY
* conditional expression is false
if the result of the subquery is empty or if the
* comparison operation is false
for every value in the result of the subquery, and is
* unknown if neither true
nor false
. The keyword SOME is
* synonymous with ANY. The comparison operators used with ALL or ANY
* conditional expressions are =, {@literal <, <=, >, >=, <>}. The result of the subquery must be
* like that of the other argument to the comparison operator in type.
*
*
BNF: all_or_any_expression ::= {ALL|ANY|SOME}(subquery)
*
* @version 2.5
* @since 2.3
* @author Pascal Filion
*/
public final class AllOrAnyExpression extends AbstractSingleEncapsulatedExpression {
/**
* Creates a new AllOrAnyExpression
.
*
* @param parent The parent of this expression
* @param identifier Either {@link Expression#ALL ALL}, {@link Expression#ANY ANY} or {@link
* Expression#SOME SOME}
*/
public AllOrAnyExpression(AbstractExpression parent, String identifier) {
super(parent, identifier);
}
@Override
public void accept(ExpressionVisitor visitor) {
visitor.visit(this);
}
@Override
public String getEncapsulatedExpressionQueryBNFId() {
return SubqueryBNF.ID;
}
@Override
public JPQLQueryBNF getQueryBNF() {
return getQueryBNF(AllOrAnyExpressionBNF.ID);
}
@Override
protected AbstractExpression parse(WordParser wordParser, String queryBNFId, boolean tolerant) {
if (tolerant) {
return super.parse(wordParser, queryBNFId, tolerant);
}
SimpleSelectStatement expression = new SimpleSelectStatement(this);
expression.parse(wordParser, tolerant);
return expression;
}
}