Class DefaultContentAssistVisitor
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.parser.AnonymousExpressionVisitor
-
- org.eclipse.persistence.jpa.jpql.tools.AbstractContentAssistVisitor
-
- org.eclipse.persistence.jpa.jpql.tools.DefaultContentAssistVisitor
-
- All Implemented Interfaces:
ExpressionVisitor
public class DefaultContentAssistVisitor extends AbstractContentAssistVisitor
This visitor traverses the JPQL parsed tree and gathers the possible proposals at a given position.Example:
// Have the external form of an IQuery
IQuery
query = ... // Create a JPQLQueryContextJPQLQueryContext
context = new JPQLQueryContext(); context.setQuery(query)
; // Create a map of the positions within the parsed treeQueryPosition
queryPosition = context.getJPQLExpression().buildPosition(query.getExpression(), position); // Either a real extension that adds additional support or ContentAssistExtension extension =ContentAssistExtension.NULL_HELPER
; // Create the visitor and visit the parsed tree DefaultContentAssistVisitor visitor = new DefaultContentAssistVisitor(context); visitor.buildProposals(queryPosition.getPosition(), extension)
; queryPosition.getExpression().accept(visitor); // Retrieve the proposalsContentAssistProposals
proposals = visitor.getProposals(); // Only required if the visitor is cached visitor.dispose(); // Only required if the context is cached context.dispose();Provisional API: This interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.
- Version:
- 2.5.1
- Author:
- Pascal Filion
- Since:
- 2.3
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
DefaultContentAssistVisitor.AcceptableTypeVisitor
The concrete instance that determines the return type of a function expression.-
Nested classes/interfaces inherited from class org.eclipse.persistence.jpa.jpql.tools.AbstractContentAssistVisitor
AbstractContentAssistVisitor.AbstractAppendableExpressionVisitor, AbstractContentAssistVisitor.AbstractConditionalClauseCollectionHelper<T extends Expression>, AbstractContentAssistVisitor.AbstractFromClauseStatementHelper<T extends AbstractSelectStatement>, AbstractContentAssistVisitor.AbstractGroupByClauseStatementHelper<T extends AbstractSelectStatement>, AbstractContentAssistVisitor.AbstractHavingClauseStatementHelper<T extends AbstractSelectStatement>, AbstractContentAssistVisitor.AbstractSelectClauseCollectionHelper<T extends AbstractSelectClause>, AbstractContentAssistVisitor.AbstractSelectClauseStatementHelper, AbstractContentAssistVisitor.AbstractWhereClauseSelectStatementHelper<T extends AbstractSelectStatement>, AbstractContentAssistVisitor.AppendableExpressionVisitor, AbstractContentAssistVisitor.AppendableType, AbstractContentAssistVisitor.CollectionExpressionHelper<T extends Expression>, AbstractContentAssistVisitor.CollectionExpressionVisitor, AbstractContentAssistVisitor.CollectionMappingFilter, AbstractContentAssistVisitor.ConcatExpressionCollectionHelper, AbstractContentAssistVisitor.ConditionalClauseCollectionHelper, AbstractContentAssistVisitor.ConstrutorCollectionHelper, AbstractContentAssistVisitor.DeclarationVisitor, AbstractContentAssistVisitor.DefaultMappingCollector, AbstractContentAssistVisitor.DeleteClauseCollectionHelper, AbstractContentAssistVisitor.DeleteClauseStatementHelper, AbstractContentAssistVisitor.DifferentComparisonFilter, AbstractContentAssistVisitor.DoubleEncapsulatedCollectionHelper, AbstractContentAssistVisitor.EncapsulatedExpressionVisitor, AbstractContentAssistVisitor.EndingQueryPositionBuilder, AbstractContentAssistVisitor.EnumVisitor, AbstractContentAssistVisitor.FilteringMappingCollector, AbstractContentAssistVisitor.FollowingClausesVisitor, AbstractContentAssistVisitor.FollowingInvalidExpressionVisitor, AbstractContentAssistVisitor.FromClauseCollectionHelper, AbstractContentAssistVisitor.FromClauseStatementHelper, AbstractContentAssistVisitor.GroupByClauseCollectionHelper, AbstractContentAssistVisitor.GroupByClauseStatementHelper, AbstractContentAssistVisitor.HavingClauseStatementHelper, AbstractContentAssistVisitor.IdentificationVariableType, AbstractContentAssistVisitor.IncompleteCollectionExpressionVisitor, AbstractContentAssistVisitor.InvalidExpressionVisitor, AbstractContentAssistVisitor.JoinCollectionHelper, AbstractContentAssistVisitor.MappingCollector, AbstractContentAssistVisitor.MappingFilterBuilder, AbstractContentAssistVisitor.MappingTypeFilter, AbstractContentAssistVisitor.NotExpressionVisitor, AbstractContentAssistVisitor.OrderByClauseCollectionHelper, AbstractContentAssistVisitor.OrderByClauseStatementHelper, AbstractContentAssistVisitor.PropertyMappingFilter, AbstractContentAssistVisitor.RangeVariableDeclarationVisitor, AbstractContentAssistVisitor.ResultVariableVisitor, AbstractContentAssistVisitor.SelectClauseCollectionHelper, AbstractContentAssistVisitor.SelectClauseStatementHelper, AbstractContentAssistVisitor.SimpleFromClauseStatementHelper, AbstractContentAssistVisitor.SimpleGroupByClauseStatementHelper, AbstractContentAssistVisitor.SimpleHavingClauseStatementHelper, AbstractContentAssistVisitor.SimpleSelectClauseCollectionHelper, AbstractContentAssistVisitor.SimpleSelectClauseStatementHelper, AbstractContentAssistVisitor.SimpleWhereClauseSelectStatementHelper, AbstractContentAssistVisitor.StatementHelper<T extends Expression>, AbstractContentAssistVisitor.SubqueryAppendableExpressionVisitor, AbstractContentAssistVisitor.SubqueryVisitor, AbstractContentAssistVisitor.TripleEncapsulatedCollectionHelper, AbstractContentAssistVisitor.UpdateClauseStatementHelper, AbstractContentAssistVisitor.UpdateItemCollectionHelper, AbstractContentAssistVisitor.VisitParentVisitor, AbstractContentAssistVisitor.WhenClauseConditionalClauseCollectionHelper, AbstractContentAssistVisitor.WhereClauseDeleteStatementHelper, AbstractContentAssistVisitor.WhereClauseSelectStatementHelper, AbstractContentAssistVisitor.WhereClauseUpdateStatementHelper, AbstractContentAssistVisitor.WithinInvalidExpressionVisitor
-
-
Field Summary
-
Fields inherited from class org.eclipse.persistence.jpa.jpql.tools.AbstractContentAssistVisitor
corrections, helpers, identifierFilters, INVALID_IDENTIFIER_FILTER, lockedExpressions, proposals, queryContext, queryPosition, SPACE_LENGTH, VALID_IDENTIFIER_FILTER, virtualSpaces, word, wordParser
-
-
Constructor Summary
Constructors Constructor Description DefaultContentAssistVisitor(JPQLQueryContext queryContext)
Creates a newDefaultContentAssistVisitor
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DefaultContentAssistVisitor.AcceptableTypeVisitor
buildAcceptableTypeVisitor()
protected JPQLGrammar
getLatestGrammar()
Returns the latest supported JPQL grammar, which is required when checking the validity of a JPQL identifier.protected boolean
isJoinFetchIdentifiable()
Determines whether aJOIN FETCH
expression can be identified by with an identification variable or not.-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.AbstractContentAssistVisitor
addAggregateIdentifier, addAggregateIdentifiers, addAggregateIdentifiers, addArithmeticIdentifiers, addClauseIdentifier, addClauseIdentifiers, addClauseIdentifiers, addComparisonIdentifiers, addCompositeIdentifier, addCompoundIdentifier, addCompoundIdentifiers, addCompoundIdentifiers, addEntities, addEntities, addEnumConstant, addEnumConstants, addExpressionFactoryIdentifiers, addExpressionFactoryIdentifiers, addFunctionIdentifier, addFunctionIdentifiers, addFunctionIdentifiers, addFunctionIdentifiers, addIdentificationVariable, addIdentificationVariables, addIdentificationVariables, addIdentifier, addJoinIdentifiers, addLeftIdentificationVariables, addLogicalIdentifiers, addRangeIdentificationVariable, addResultVariables, addVirtualSpace, areArithmeticSymbolsAppendable, areComparisonSymbolsAppendable, areLogicalSymbolsAppendable, buildAppendableExpressionVisitor, buildCollectionCompoundTypeFilter, buildCollectionExpressionVisitor, buildCollectionMappingFilter, buildConcatExpressionCollectionHelper, buildConditionalClauseCollectionHelper, buildConstrutorCollectionHelper, buildDeclarationVisitor, buildDefaultMappingCollector, buildDeleteClauseCollectionHelper, buildDeleteClauseStatementHelper, buildDifferentComparisonFilter, buildDoubleEncapsulatedCollectionHelper, buildEncapsulatedExpressionVisitor, buildEndingPositionFromInvalidExpression, buildEndingQueryPositionBuilder, buildEnumVisitor, buildFilteringMappingCollector, buildFollowingClausesVisitor, buildFollowingInvalidExpressionVisitor, buildFromClauseCollectionHelper, buildFromClauseStatementHelper, buildGroupByClauseCollectionHelper, buildGroupByClauseStatementHelper, buildHavingClauseStatementHelper, buildIncompleteCollectionExpressionVisitor, buildInvalidExpressionVisitor, buildJoinCollectionHelper, buildJPQLQueryBNFValidator, buildMappingCollector, buildMappingFilter, buildMappingFilter, buildMappingFilterBuilder, buildNonCollectionCompoundTypeFilter, buildNotExpressionVisitor, buildOrderByClauseCollectionHelper, buildOrderByClauseStatementHelper, buildPropertyMappingFilter, buildProposals, buildProposals, buildRangeVariableDeclarationVisitor, buildResultVariableVisitor, buildSelectClauseCollectionHelper, buildSelectClauseStatementHelper, buildSimpleFromClauseStatementHelper, buildSimpleGroupByClauseStatementHelper, buildSimpleHavingClauseStatementHelper, buildSimpleSelectClauseCollectionHelper, buildSimpleSelectClauseStatementHelper, buildSimpleWhereClauseSelectStatementHelper, buildSubqueryAppendableExpressionVisitor, buildSubqueryVisitor, buildTripleEncapsulatedCollectionHelper, buildUpdateClauseStatementHelper, buildUpdateItemCollectionHelper, buildVisitParentVisitor, buildWhenClauseConditionalClauseCollectionHelper, buildWhereClauseDeleteStatementHelper, buildWhereClauseSelectStatementHelper, buildWhereClauseUpdateStatementHelper, buildWithinInvalidExpressionVisitor, dispose, findRangeVariableDeclaration, getAcceptableType, getAppendableExpressionVisitor, getCollectionExpression, getCollectionExpressionVisitor, getConcatExpressionCollectionHelper, getConditionalClauseCollectionHelper, getConstructorCollectionHelper, getDeclarationVisitor, getDefaultMappingCollector, getDeleteClauseCollectionHelper, getDeleteClauseStatementHelper, getDoubleEncapsulatedCollectionHelper, getEncapsulatedExpressionVisitor, getEndingQueryPositionBuilder, getEnumVisitor, getExpressionFactory, getExpressionTypeVisitor, getFilter, getFollowingClausesVisitor, getFollowingInvalidExpressionVisitor, getFromClauseCollectionHelper, getFromClauseStatementHelper, getGroupByClauseCollectionHelper, getGroupByClauseStatementHelper, getHavingClauseStatementHelper, getHelper, getIdentifierRole, getIncompleteCollectionExpressionVisitor, getInvalidExpressionVisitor, getJoinCollectionHelper, getMappingCollectionFilter, getMappingFilterBuilder, getMappingPropertyFilter, getNotExpressionVisitor, getOrderByClauseCollectionHelper, getOrderByClauseStatementHelper, getQueryBNF, getRangeVariableDeclarationVisitor, getResultVariableVisitor, getSelectClauseCollectionHelper, getSelectClauseStatementHelper, getSimpleFromClauseStatementHelper, getSimpleGroupByClauseStatementHelper, getSimpleHavingClauseStatementHelper, getSimpleSelectClauseCollectionHelper, getSimpleSelectClauseStatementHelper, getSimpleWhereClauseSelectStatementHelper, getSubqueryAppendableExpressionVisitor, getSubqueryVisitor, getTripleEncapsulatedCollectionHelper, getUpdateClauseStatementHelper, getUpdateItemCollectionHelper, getVisitParentVisitor, getWhenClauseConditionalClauseCollectionHelper, getWhereClauseDeleteStatementHelper, getWhereClauseSelectStatementHelper, getWhereClauseUpdateStatementHelper, getWithinInvalidExpressionVisitor, hasClausesDefinedBetween, hasVirtualSpace, initialize, isAggregate, isAppendable, isAppendableToCollection, isClause, isClauseAppendable, isComplete, isCompoundable, isCompoundFunction, isDeclaration, isEncapsulated, isEnumAllowed, isFollowingInvalidExpression, isFunction, isInSubquery, isInvalidExpression, isLocked, isNotExpression, isPositionWithin, isPositionWithin, isSubqueryAppendable, isValid, isValid, isValid, isValid, isValid, isValidProposal, isValidVersion, isWithinInvalidExpression, registerHelper, removeVirtualSpace, toString, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitAggregateFunction, visitArithmeticExpression, visitCollectionExpression, visitEndingExpression, visitEnumConstant, visitInvalidExpression, visitLogicalExpression, visitPathExpression, visitPathExpression, visitSingleEncapsulatedExpression, visitSingleEncapsulatedExpression, visitStatement, visitThirdPartyPathExpression
-
-
-
-
Constructor Detail
-
DefaultContentAssistVisitor
public DefaultContentAssistVisitor(JPQLQueryContext queryContext)
Creates a newDefaultContentAssistVisitor
.- Parameters:
queryContext
- The context used to query information about the query- Throws:
java.lang.NullPointerException
- TheJPQLQueryContext
cannot benull
-
-
Method Detail
-
buildAcceptableTypeVisitor
protected DefaultContentAssistVisitor.AcceptableTypeVisitor buildAcceptableTypeVisitor()
- Specified by:
buildAcceptableTypeVisitor
in classAbstractContentAssistVisitor
-
getLatestGrammar
protected JPQLGrammar getLatestGrammar()
Returns the latest supported JPQL grammar, which is required when checking the validity of a JPQL identifier. This is due to the fact that any JPQL identifiers defined in a more recent spec will be seen to be registered in version 1.0 of the spec. By returning the latest version, any JPQL identifiers should have a version registered.- Specified by:
getLatestGrammar
in classAbstractContentAssistVisitor
- Returns:
- The latest
JPQLGrammar
supported by the provider
-
isJoinFetchIdentifiable
protected boolean isJoinFetchIdentifiable()
Determines whether aJOIN FETCH
expression can be identified by with an identification variable or not.- Specified by:
isJoinFetchIdentifiable
in classAbstractContentAssistVisitor
- Returns:
true
if the expression can have an identification variable;false
otherwise
-
-