public abstract class AbstractJPQLQueryHelper
extends java.lang.Object
getResultType()
;getParameterType(String)
.buildContentAssistProposals(int)
.buildBasicRefactoringTool()
provides support for generating the delta of the
refactoring operation through a collection of TextEdit
objects.buildRefactoringTool()
provides support for refactoring the JPQL query through
the editable StateObject
and once all refactoring operations have been executed, the IJPQLQueryFormatter
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.
Constructor and Description |
---|
AbstractJPQLQueryHelper(JPQLGrammar jpqlGrammar)
Creates a new
AbstractJPQLQueryHelper . |
Modifier and Type | Method and Description |
---|---|
abstract BasicRefactoringTool |
buildBasicRefactoringTool()
Creates the concrete instance of the tool that can refactor the content of a JPQL query.
|
ContentAssistProposals |
buildContentAssistProposals(int position)
Retrieves the possibles choices that can complete the query from the given position within
the query.
|
ContentAssistProposals |
buildContentAssistProposals(int position,
ContentAssistExtension extension)
Retrieves the possibles choices that can complete the query from the given position within
the query.
|
abstract RefactoringTool |
buildRefactoringTool()
Creates the concrete instance of the tool that can refactor the content of a JPQL query.
|
void |
dispose()
Disposes of the internal data.
|
JPQLGrammar |
getGrammar()
Returns the JPQL grammar that will be used to define how to parse a JPQL query.
|
JPQLExpression |
getJPQLExpression()
Returns the root of the parsed tree representation of the JPQL query.
|
IType |
getParameterType(java.lang.String parameterName)
Retrieves, if it can be determined, the type of the given input parameter with the given name.
|
java.lang.String |
getParsedJPQLQuery()
Returns the string representation of the parsed tree.
|
IManagedTypeProvider |
getProvider()
Returns the provider for managed types (entities, embeddables, mapped superclasses).
|
IQuery |
getQuery()
Returns the external form representing a named query.
|
JPQLQueryContext |
getQueryContext()
Returns the
JPQLQueryContext that contains information about the JPQL query. |
IType |
getResultType()
Calculates the type of the query result of the JPQL query.
|
IType |
getType(java.lang.Class<?> type)
Returns the
IType representing the given Java type. |
TypeHelper |
getTypeHelper()
Returns a helper that gives access to the most common
types . |
ITypeRepository |
getTypeRepository()
Returns the repository that gives access to the application's types.
|
void |
setJPQLExpression(JPQLExpression jpqlExpression)
Sets the parsed tree representation of the JPQL query.
|
void |
setQuery(IQuery query)
Sets the external form of the JPQL query, which will be parsed and information will be
extracted for later access.
|
java.util.List<JPQLQueryProblem> |
validate()
Validates the query by introspecting it grammatically and semantically.
|
void |
validate(Expression expression,
java.util.List<JPQLQueryProblem> problems)
Validates the query by introspecting it grammatically and semantically.
|
java.util.List<JPQLQueryProblem> |
validateGrammar()
Validates the query by only introspecting it grammatically.
|
void |
validateGrammar(Expression expression,
java.util.List<JPQLQueryProblem> problems)
Validates the query by only introspecting it grammatically.
|
java.util.List<JPQLQueryProblem> |
validateSemantic()
Validates the query by only introspecting it semantically.
|
void |
validateSemantic(Expression expression,
java.util.List<JPQLQueryProblem> problems)
Validates the query by only introspecting it semantically.
|
public AbstractJPQLQueryHelper(JPQLGrammar jpqlGrammar)
AbstractJPQLQueryHelper
.jpqlGrammar
- The JPQLGrammar
that will determine how to parse JPQL queriespublic abstract BasicRefactoringTool buildBasicRefactoringTool()
RefactoringTool
buildRefactoringTool()
public ContentAssistProposals buildContentAssistProposals(int position)
Note: Disposing of the internal data is not done automatically.
position
- The position within the query for which a list of possible choices are created
for completing the querypublic ContentAssistProposals buildContentAssistProposals(int position, ContentAssistExtension extension)
Note: Disposing of the internal data is not done automatically.
position
- The position within the query for which a list of possible choices are created
for completing the queryextension
- This extension can be used to provide additional information that is outside
the scope of simply providing JPA metadata information, such as table names, column names,
class namespublic abstract RefactoringTool buildRefactoringTool()
StateObject
and simply
outputs the result of the refactoring operations, i.e. the updated JPQL query).RefactoringTool
buildBasicRefactoringTool()
public void dispose()
public JPQLGrammar getGrammar()
Expression
public JPQLExpression getJPQLExpression()
public IType getParameterType(java.lang.String parameterName)
Note: Both named and positional input parameter can be used.
parameterName
- The name of the input parameter to retrieve its type, which needs to be
prepended by ':' or '?'null
if the type
couldn't be determinedpublic java.lang.String getParsedJPQLQuery()
public IManagedTypeProvider getProvider()
public IQuery getQuery()
public JPQLQueryContext getQueryContext()
JPQLQueryContext
that contains information about the JPQL query.JPQLQueryContext
that contains information contained in the JPQL querypublic IType getResultType()
See Resolver
to understand how the type is calculated.
IType
for Object
if it could not be calculatedpublic IType getType(java.lang.Class<?> type)
IType
representing the given Java type.type
- The Java type for which its external form is requestedpublic TypeHelper getTypeHelper()
types
.IType
public ITypeRepository getTypeRepository()
public void setJPQLExpression(JPQLExpression jpqlExpression)
setQuery(IQuery)
because the JPQL query is automatically parsed by that method.jpqlExpression
- The parsed representation of the JPQL query to manipulatesetQuery(IQuery)
public void setQuery(IQuery query)
query
- The external form of the JPQL querypublic java.util.List<JPQLQueryProblem> validate()
null
list that will be used to store the problems
if any was foundpublic void validate(Expression expression, java.util.List<JPQLQueryProblem> problems)
expression
- The parsed tree representation of the JPQL fragment to validateproblems
- A non-null
list that will be used to store the problems
if any was foundpublic java.util.List<JPQLQueryProblem> validateGrammar()
null
list that will be used to store the problems
if any was foundpublic void validateGrammar(Expression expression, java.util.List<JPQLQueryProblem> problems)
expression
- The parsed tree representation of the queryproblems
- A non-null
list that will be used to store the problems
if any was foundpublic java.util.List<JPQLQueryProblem> validateSemantic()
null
list that will be used to store the problems
if any was foundpublic void validateSemantic(Expression expression, java.util.List<JPQLQueryProblem> problems)
expression
- The parsed tree representation of the queryproblems
- A non-null
list that will be used to store the problems
if any was foundEclipseLink 2.6.3, "build v20160428-59c81c5" API Reference