Class DefaultJPQLQueryHelper
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.AbstractJPQLQueryHelper
-
- org.eclipse.persistence.jpa.jpql.tools.DefaultJPQLQueryHelper
-
public class DefaultJPQLQueryHelper extends AbstractJPQLQueryHelper
This helper can perform the following operations over a JPQL query:- Calculates the result type of a query:
AbstractJPQLQueryHelper.getResultType()
; - Calculates the type of an input parameter:
AbstractJPQLQueryHelper.getParameterType(String)
. - Calculates the possible choices to complete the query from a given
position (used for content assist):
AbstractJPQLQueryHelper.buildContentAssistProposals(int)
. - Validates the query by introspecting it grammatically and semantically:
- Refactoring support:
buildBasicRefactoringTool()
provides support for generating the delta of the refactoring operation through a collection ofTextEdit
objects.buildRefactoringTool()
provides support for refactoring the JPQL query through the editableStateObject
and once all refactoring operations have been executed, theIJPQLQueryFormatter
will generate a new string representation of the JPQL query.
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
- Author:
- Pascal Filion
- Since:
- 2.3
- Calculates the result type of a query:
-
-
Constructor Summary
Constructors Constructor Description DefaultJPQLQueryHelper(JPQLGrammar jpqlGrammar)
Creates a newDefaultJPQLQueryHelper
.DefaultJPQLQueryHelper(JPQLQueryContext queryContext)
Creates a newJPQLQueryHelper
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BasicRefactoringTool
buildBasicRefactoringTool()
Creates the concrete instance of the tool that can refactor the content of a JPQL query.protected AbstractContentAssistVisitor
buildContentAssistVisitor(JPQLQueryContext queryContext)
Creates the concrete instance of the content assist visitor that will give the possible choices based on the position of the cursor within the JPQL query.protected DefaultGrammarValidator
buildGrammarValidator(JPQLGrammar jpqlGrammar)
Creates the concrete instance of the validator that will grammatically validate the JPQL query.protected JPQLQueryContext
buildJPQLQueryContext(JPQLGrammar jpqlGrammar)
Creates a context that will be used to store and retrieve information about the JPQL query.protected IJPQLQueryBuilder
buildQueryBuilder()
Creates the rightIJPQLQueryBuilder
based on the JPQL grammar.RefactoringTool
buildRefactoringTool()
Creates the concrete instance of the tool that can refactor the content of a JPQL query.protected DefaultSemanticValidator
buildSemanticValidator(JPQLQueryContext queryContext)
Creates the concrete instance of the validator that will semantically validate the JPQL query.-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.AbstractJPQLQueryHelper
buildContentAssistProposals, buildContentAssistProposals, buildNumericTypeComparator, dispose, getContentAssistVisitor, getGrammar, getGrammarValidator, getJPQLExpression, getParameterType, getParsedJPQLQuery, getProvider, getQuery, getQueryContext, getResultType, getSemanticValidator, getType, getTypeHelper, getTypeRepository, setJPQLExpression, setQuery, validate, validate, validateGrammar, validateGrammar, validateSemantic, validateSemantic
-
-
-
-
Constructor Detail
-
DefaultJPQLQueryHelper
public DefaultJPQLQueryHelper(JPQLGrammar jpqlGrammar)
Creates a newDefaultJPQLQueryHelper
.- Parameters:
jpqlGrammar
- TheJPQLGrammar
that will determine how to parse JPQL queries
-
DefaultJPQLQueryHelper
public DefaultJPQLQueryHelper(JPQLQueryContext queryContext)
Creates a newJPQLQueryHelper
.- Parameters:
queryContext
- The context used to query information about the JPQL query
-
-
Method Detail
-
buildBasicRefactoringTool
public BasicRefactoringTool buildBasicRefactoringTool()
Creates the concrete instance of the tool that can refactor the content of a JPQL query. This version simply provides the delta of the refactoring operations.- Specified by:
buildBasicRefactoringTool
in classAbstractJPQLQueryHelper
- Returns:
- The concrete instance of
RefactoringTool
- See Also:
AbstractJPQLQueryHelper.buildRefactoringTool()
-
buildContentAssistVisitor
protected AbstractContentAssistVisitor buildContentAssistVisitor(JPQLQueryContext queryContext)
Creates the concrete instance of the content assist visitor that will give the possible choices based on the position of the cursor within the JPQL query.- Specified by:
buildContentAssistVisitor
in classAbstractJPQLQueryHelper
- Parameters:
queryContext
- The context used to query information about the JPQL query- Returns:
- A new concrete instance of
AbstractContentAssistVisitor
-
buildGrammarValidator
protected DefaultGrammarValidator buildGrammarValidator(JPQLGrammar jpqlGrammar)
Creates the concrete instance of the validator that will grammatically validate the JPQL query.- Specified by:
buildGrammarValidator
in classAbstractJPQLQueryHelper
- Parameters:
jpqlGrammar
- The context used to query information about the JPQL query- Returns:
- A new concrete instance of
AbstractGrammarValidator
-
buildJPQLQueryContext
protected JPQLQueryContext buildJPQLQueryContext(JPQLGrammar jpqlGrammar)
Creates a context that will be used to store and retrieve information about the JPQL query.- Specified by:
buildJPQLQueryContext
in classAbstractJPQLQueryHelper
- Parameters:
jpqlGrammar
- The JPQL grammar that is required for dictating how the JPQL query will be parsed. It is also used by validation and by the content assist- Returns:
- A new
JPQLQueryContext
-
buildQueryBuilder
protected IJPQLQueryBuilder buildQueryBuilder()
Creates the rightIJPQLQueryBuilder
based on the JPQL grammar.- Returns:
- A new concrete instance of
IJPQLQueryBuilder
-
buildRefactoringTool
public RefactoringTool buildRefactoringTool()
Creates the concrete instance of the tool that can refactor the content of a JPQL query. This version provides a way to manipulate the editable version of the JPQL query (StateObject
and simply outputs the result of the refactoring operations, i.e. the updated JPQL query).- Specified by:
buildRefactoringTool
in classAbstractJPQLQueryHelper
- Returns:
- The concrete instance of
RefactoringTool
- See Also:
AbstractJPQLQueryHelper.buildBasicRefactoringTool()
-
buildSemanticValidator
protected DefaultSemanticValidator buildSemanticValidator(JPQLQueryContext queryContext)
Creates the concrete instance of the validator that will semantically validate the JPQL query.- Specified by:
buildSemanticValidator
in classAbstractJPQLQueryHelper
- Parameters:
queryContext
- The context used to query information about the JPQL query- Returns:
- A new concrete instance of
AbstractSemanticValidator
-
-