All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.persistence.jpa.jpql.parser.SubExpression Maven / Gradle / Ivy

There is a newer version: 5.0.0-B03
Show newest version
/*
 * Copyright (c) 2006, 2018 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.ExpressionTools;

/**
 * This expression wraps a sub-expression within parenthesis.
 *
 * 
BNF: expression ::= (sub_expression)

* * @version 2.5 * @since 2.3 * @author Pascal Filion */ public final class SubExpression extends AbstractSingleEncapsulatedExpression { /** * The {@link JPQLQueryBNF} coming from the parent that is used to parse the next portion of the query. */ private JPQLQueryBNF queryBNF; /** * Creates a new SubExpression. * * @param parent The parent of this expression * @param queryBNF The BNF coming from the parent that is used to parse the next portion of the query */ public SubExpression(AbstractExpression parent, JPQLQueryBNF queryBNF) { super(parent, ExpressionTools.EMPTY_STRING); this.queryBNF = queryBNF; } /** * {@inheritDoc} */ public void accept(ExpressionVisitor visitor) { visitor.visit(this); } /** * {@inheritDoc} */ @Override protected boolean areLogicalIdentifiersSupported() { return true; } /** * {@inheritDoc} */ @Override public String getEncapsulatedExpressionQueryBNFId() { return queryBNF.getId(); } /** * {@inheritDoc} */ @Override public JPQLQueryBNF findQueryBNF(Expression expression) { if (hasExpression() && (getExpression().isAncestor(expression))) { return queryBNF; } return getParent().findQueryBNF(expression); } /** * {@inheritDoc} */ public JPQLQueryBNF getQueryBNF() { return queryBNF; } /** * {@inheritDoc} */ @Override protected boolean handleCollection(JPQLQueryBNF queryBNF) { return true; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy