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

org.eclipse.persistence.jpa.jpql.tools.DefaultJPQLQueryContext Maven / Gradle / Ivy

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

import org.eclipse.persistence.jpa.jpql.parser.Expression;
import org.eclipse.persistence.jpa.jpql.parser.JPQLGrammar;
import org.eclipse.persistence.jpa.jpql.tools.resolver.DefaultResolverBuilder;

/**
 * This context is used to store information related to the JPQL query.
 *
 * 
 {@link org.eclipse.persistence.jpa.jpql.tools.spi.IQuery IQuery} externalQuery = ...;
 *
 * JPQLQueryContext context = new JPQLQueryContext(DefaultJPQLGrammar.instance());
 * context.setQuery(query);
* * If the JPQL query is already parsed, then the context can use it and it needs to be set before * setting the {@link org.eclipse.persistence.jpa.jpql.tools.spi.IQuery IQuery}: *
 {@link org.eclipse.persistence.jpa.jpql.parser.JPQLExpression JPQLExpression} jpqlExpression = ...;
 *
 * JPQLQueryContext context = new JPQLQueryContext(DefaultJPQLGrammar.instance());
 * context.setJPQLExpression(jpqlExpression);
 * context.setQuery(query);
* * @version 2.4 * @since 2.4 * @author Pascal Filion */ public class DefaultJPQLQueryContext extends JPQLQueryContext { /** * Creates a new DefaultJPQLQueryContext. */ public DefaultJPQLQueryContext(JPQLGrammar jpqlGrammar) { super(jpqlGrammar); } /** * Creates a new sub-DefaultJPQLQueryContext. * * @param parent The parent context * @param currentQuery The parsed tree representation of the subquery */ protected DefaultJPQLQueryContext(JPQLQueryContext parent, Expression currentQuery) { super(parent, currentQuery); } /** * {@inheritDoc} */ @Override protected JPQLQueryContext buildJPQLQueryContext(JPQLQueryContext currentContext, Expression currentQuery) { return new DefaultJPQLQueryContext(currentContext, currentQuery); } /** * {@inheritDoc} */ @Override protected DefaultLiteralVisitor buildLiteralVisitor() { return new DefaultLiteralVisitor(); } /** * {@inheritDoc} */ @Override protected DefaultParameterTypeVisitor buildParameterTypeVisitor() { return new DefaultParameterTypeVisitor(this); } /** * {@inheritDoc} */ @Override protected DefaultResolverBuilder buildResolverBuilder() { return new DefaultResolverBuilder(this); } /** * {@inheritDoc} */ @Override public DefaultJPQLQueryContext getParent() { return (DefaultJPQLQueryContext) super.getParent(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy