protected static class AbstractContentAssistVisitor.EndingQueryPositionBuilder extends java.lang.Object implements ExpressionVisitor
QueryPosition
by traversing the valid portion of the JPQL
query. The position is the end of each Expression
.
For instance, "SELECT e FROM Employee e O WHERE e.name = 'JPQL'", the valid fragment is "SELECT e FROM Employee e", the positions will be:
Modifier and Type | Field and Description |
---|---|
protected boolean |
badExpression
This internal flag helps to determine if the
Expression where the cursor is located
was flagged to be invalid. |
protected int |
correction
This is used to correct the length of an
Expression |
protected Expression |
invalidExpression
The
Expression containing the invalid fragment. |
protected int |
positionWithinInvalidExpression
The position of the cursor within the invalid expression.
|
QueryPosition |
queryPosition
This
QueryPosition has the position of each Expression within the valid
fragment of the JPQL query. |
boolean |
virtualSpace
Indicates whether a virtual space should be added to the stack or not.
|
Modifier | Constructor and Description |
---|---|
protected |
EndingQueryPositionBuilder(AbstractContentAssistVisitor visitor) |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes the internal data.
|
QueryPosition |
getQueryPosition()
Returns the new
QueryPosition that was created. |
boolean |
hasVirtualSpace()
Determines whether a virtual space should be added to the stack or not.
|
void |
prepare(Expression invalidExpression)
Prepares this visitor before visiting an
Expression . |
void |
visit(AbsExpression expression)
Visits the
AbsExpression expression. |
void |
visit(AbstractSchemaName expression)
Visits the
AbstractSchemaName expression. |
void |
visit(AdditionExpression expression)
Visits the
AdditionExpression expression. |
void |
visit(AllOrAnyExpression expression)
Visits the
AllOrAnyExpression expression. |
void |
visit(AndExpression expression)
Visits the
AndExpression expression. |
void |
visit(ArithmeticFactor expression)
Visits the
ArithmeticFactor expression. |
void |
visit(AvgFunction expression)
Visits the
AvgFunction expression. |
void |
visit(BadExpression expression)
Visits the
BadExpression expression. |
void |
visit(BetweenExpression expression)
Visits the
BetweenExpression expression. |
void |
visit(CaseExpression expression)
Visits the
CaseExpression expression. |
void |
visit(CoalesceExpression expression)
Visits the
CoalesceExpression expression. |
void |
visit(CollectionExpression expression)
Visits the
CollectionExpression expression. |
void |
visit(CollectionMemberDeclaration expression)
Visits the
CollectionMemberDeclaration expression. |
void |
visit(CollectionMemberExpression expression)
Visits the
CollectionMemberExpression expression. |
void |
visit(CollectionValuedPathExpression expression)
Visits the
CollectionValuedPathExpression expression. |
void |
visit(ComparisonExpression expression)
Visits the
ComparisonExpression expression. |
void |
visit(ConcatExpression expression)
Visits the
ConcatExpression expression. |
void |
visit(ConstructorExpression expression)
Visits the
ConstructorExpression expression. |
void |
visit(CountFunction expression)
Visits the
CountFunction expression. |
void |
visit(DateTime expression)
Visits the
DateTime expression. |
void |
visit(DeleteClause expression)
Visits the
DeleteClause expression. |
void |
visit(DeleteStatement expression)
Visits the
DeleteStatement expression. |
void |
visit(DivisionExpression expression)
Visits the
DivisionExpression expression. |
void |
visit(EmptyCollectionComparisonExpression expression)
Visits the
EmptyCollectionComparisonExpression expression. |
void |
visit(EntityTypeLiteral expression)
Visits the
EntityTypeLiteral expression. |
void |
visit(EntryExpression expression)
Visits the
EntryExpression expression. |
void |
visit(ExistsExpression expression)
Visits the
ExistsExpression expression. |
void |
visit(FromClause expression)
Visits the
FromClause expression. |
void |
visit(FunctionExpression expression)
Visits the
FunctionExpression expression. |
void |
visit(GroupByClause expression)
Visits the
GroupByClause expression. |
void |
visit(HavingClause expression)
Visits the
HavingClause expression. |
void |
visit(IdentificationVariable expression)
Visits the
IdentificationVariable expression. |
void |
visit(IdentificationVariableDeclaration expression)
Visits the
IdentificationVariableDeclaration expression. |
void |
visit(IndexExpression expression)
Visits the
IndexExpression expression. |
void |
visit(InExpression expression)
Visits the
InExpression expression. |
void |
visit(InputParameter expression)
Visits the
InputParameter expression. |
void |
visit(Join expression)
Visits the
Join expression. |
void |
visit(JPQLExpression expression)
Visits the
JPQLExpression expression. |
void |
visit(KeyExpression expression)
Visits the
KeyExpression expression. |
void |
visit(KeywordExpression expression)
Visits the
KeywordExpression expression. |
void |
visit(LengthExpression expression)
Visits the
LengthExpression expression. |
void |
visit(LikeExpression expression)
Visits the
LikeExpression expression. |
void |
visit(LocateExpression expression)
Visits the
LocateExpression expression. |
void |
visit(LowerExpression expression)
Visits the
LowerExpression expression. |
void |
visit(MaxFunction expression)
Visits the
MaxFunction expression. |
void |
visit(MinFunction expression)
Visits the
MinFunction expression. |
void |
visit(ModExpression expression)
Visits the
ModExpression expression. |
void |
visit(MultiplicationExpression expression)
Visits the
MultiplicationExpression expression. |
void |
visit(NotExpression expression)
Visits the
NotExpression expression. |
void |
visit(NullComparisonExpression expression)
Visits the
NullComparisonExpression expression. |
void |
visit(NullExpression expression)
Visits the
NullExpression expression. |
void |
visit(NullIfExpression expression)
Visits the
NullIfExpression expression. |
void |
visit(NumericLiteral expression)
Visits the
NumericLiteral expression. |
void |
visit(ObjectExpression expression)
Visits the
ObjectExpression expression. |
void |
visit(OnClause expression)
Visits the
OnClause expression. |
void |
visit(OrderByClause expression)
Visits the
OrderByClause expression. |
void |
visit(OrderByItem expression)
Visits the
OrderByItem expression. |
void |
visit(OrExpression expression)
Visits the
OrExpression expression. |
void |
visit(RangeVariableDeclaration expression)
Visits the
RangeVariableDeclaration expression. |
void |
visit(ResultVariable expression)
Visits the
ResultVariable expression. |
void |
visit(SelectClause expression)
Visits the
SelectClause expression. |
void |
visit(SelectStatement expression)
Visits the
SelectStatement expression. |
void |
visit(SimpleFromClause expression)
Visits the
SimpleFromClause expression. |
void |
visit(SimpleSelectClause expression)
Visits the
SimpleSelectClause expression. |
void |
visit(SimpleSelectStatement expression)
Visits the
SimpleSelectStatement expression. |
void |
visit(SizeExpression expression)
Visits the
SizeExpression expression. |
void |
visit(SqrtExpression expression)
Visits the
SqrtExpression expression. |
void |
visit(StateFieldPathExpression expression)
Visits the
StateFieldPathExpression expression. |
void |
visit(StringLiteral expression)
Visits the
StringLiteral expression. |
void |
visit(SubExpression expression)
Visits the
SubExpression expression. |
void |
visit(SubstringExpression expression)
Visits the
SubstringExpression expression. |
void |
visit(SubtractionExpression expression)
Visits the
SubtractionExpression expression. |
void |
visit(SumFunction expression)
Visits the
SumFunction expression. |
void |
visit(TreatExpression expression)
Visits the
TreatExpression expression. |
void |
visit(TrimExpression expression)
Visits the
TrimExpression expression. |
void |
visit(TypeExpression expression)
Visits the
TypeExpression expression. |
void |
visit(UnknownExpression expression)
Visits the
UnknownExpression expression. |
void |
visit(UpdateClause expression)
Visits the
UpdateClause expression. |
void |
visit(UpdateItem expression)
Visits the
UpdateItem expression. |
void |
visit(UpdateStatement expression)
Visits the
UpdateStatement expression. |
void |
visit(UpperExpression expression)
Visits the
UpperExpression expression. |
void |
visit(ValueExpression expression)
Visits the
ValueExpression expression. |
void |
visit(WhenClause expression)
Visits the
WhenClause expression. |
void |
visit(WhereClause expression)
Visits the
WhereClause expression. |
protected void |
visitAbstractConditionalClause(AbstractConditionalClause expression) |
protected void |
visitAbstractDoubleEncapsulatedExpression(AbstractDoubleEncapsulatedExpression expression) |
protected void |
visitAbstractFromClause(AbstractFromClause expression) |
protected void |
visitAbstractSingleEncapsulatedExpression(AbstractSingleEncapsulatedExpression expression) |
protected void |
visitAbstractTripleEncapsulatedExpression(AbstractTripleEncapsulatedExpression expression) |
protected void |
visitCompoundExpression(CompoundExpression expression) |
protected boolean badExpression
Expression
where the cursor is located
was flagged to be invalid. If so, this helps to determine how to handle the calculation of
the new position within the query.
For instance: "SELECT e FROM Employee e AS" has a bad expression wrapping the identifier "AS", which is parsed as a result variable. In this case, the position would actually be 2 within the bad expression. If the bad expression was something more complex than just a single word, then that expression should not be included in the position.
protected int correction
Expression
protected Expression invalidExpression
Expression
containing the invalid fragment.protected int positionWithinInvalidExpression
public QueryPosition queryPosition
QueryPosition
has the position of each Expression
within the valid
fragment of the JPQL query.public boolean virtualSpace
protected EndingQueryPositionBuilder(AbstractContentAssistVisitor visitor)
public void dispose()
public QueryPosition getQueryPosition()
QueryPosition
that was created.public boolean hasVirtualSpace()
true
if a virtual space should be considered; false
otherwisepublic void prepare(Expression invalidExpression)
Expression
. dispose()
is called
after the visit operation is complete.invalidExpression
- The Expression
containing the invalid fragmentpublic void visit(AbsExpression expression)
AbsExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(AbstractSchemaName expression)
AbstractSchemaName
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(AdditionExpression expression)
AdditionExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(AllOrAnyExpression expression)
AllOrAnyExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(AndExpression expression)
AndExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(ArithmeticFactor expression)
ArithmeticFactor
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(AvgFunction expression)
AvgFunction
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(BadExpression expression)
BadExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(BetweenExpression expression)
BetweenExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(CaseExpression expression)
CaseExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(CoalesceExpression expression)
CoalesceExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(CollectionExpression expression)
CollectionExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(CollectionMemberDeclaration expression)
CollectionMemberDeclaration
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(CollectionMemberExpression expression)
CollectionMemberExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(CollectionValuedPathExpression expression)
CollectionValuedPathExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(ComparisonExpression expression)
ComparisonExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(ConcatExpression expression)
ConcatExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(ConstructorExpression expression)
ConstructorExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(CountFunction expression)
CountFunction
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(DateTime expression)
DateTime
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(DeleteClause expression)
DeleteClause
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(DeleteStatement expression)
DeleteStatement
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(DivisionExpression expression)
DivisionExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(EmptyCollectionComparisonExpression expression)
EmptyCollectionComparisonExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(EntityTypeLiteral expression)
EntityTypeLiteral
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(EntryExpression expression)
EntryExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(ExistsExpression expression)
ExistsExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(FromClause expression)
FromClause
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(FunctionExpression expression)
FunctionExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(GroupByClause expression)
GroupByClause
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(HavingClause expression)
HavingClause
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(IdentificationVariable expression)
IdentificationVariable
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(IdentificationVariableDeclaration expression)
IdentificationVariableDeclaration
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(IndexExpression expression)
IndexExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(InExpression expression)
InExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(InputParameter expression)
InputParameter
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(Join expression)
Join
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(JPQLExpression expression)
JPQLExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(KeyExpression expression)
KeyExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(KeywordExpression expression)
KeywordExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(LengthExpression expression)
LengthExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(LikeExpression expression)
LikeExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(LocateExpression expression)
LocateExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(LowerExpression expression)
LowerExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(MaxFunction expression)
MaxFunction
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(MinFunction expression)
MinFunction
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(ModExpression expression)
ModExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(MultiplicationExpression expression)
MultiplicationExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(NotExpression expression)
NotExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(NullComparisonExpression expression)
NullComparisonExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(NullExpression expression)
NullExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(NullIfExpression expression)
NullIfExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(NumericLiteral expression)
NumericLiteral
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(ObjectExpression expression)
ObjectExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(OnClause expression)
OnClause
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(OrderByClause expression)
OrderByClause
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(OrderByItem expression)
OrderByItem
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(OrExpression expression)
OrExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(RangeVariableDeclaration expression)
RangeVariableDeclaration
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(ResultVariable expression)
ResultVariable
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(SelectClause expression)
SelectClause
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(SelectStatement expression)
SelectStatement
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(SimpleFromClause expression)
SimpleFromClause
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(SimpleSelectClause expression)
SimpleSelectClause
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(SimpleSelectStatement expression)
SimpleSelectStatement
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(SizeExpression expression)
SizeExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(SqrtExpression expression)
SqrtExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(StateFieldPathExpression expression)
StateFieldPathExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(StringLiteral expression)
StringLiteral
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(SubExpression expression)
SubExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(SubstringExpression expression)
SubstringExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(SubtractionExpression expression)
SubtractionExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(SumFunction expression)
SumFunction
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(TreatExpression expression)
TreatExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(TrimExpression expression)
TrimExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(TypeExpression expression)
TypeExpression
expression.visit
in interface ExpressionVisitor
expression
- The Expression
to visitpublic void visit(UnknownExpression expression)
UnknownExpression
expression.visit
in interface ExpressionVisitor
expression
- The UnknownExpression
to visitpublic void visit(UpdateClause expression)
UpdateClause
expression.visit
in interface ExpressionVisitor
expression
- The UpdateClause
to visitpublic void visit(UpdateItem expression)
UpdateItem
expression.visit
in interface ExpressionVisitor
expression
- The UpdateItem
to visitpublic void visit(UpdateStatement expression)
UpdateStatement
expression.visit
in interface ExpressionVisitor
expression
- The UpdateStatement
to visitpublic void visit(UpperExpression expression)
UpperExpression
expression.visit
in interface ExpressionVisitor
expression
- The UpperExpression
to visitpublic void visit(ValueExpression expression)
ValueExpression
expression.visit
in interface ExpressionVisitor
expression
- The ValueExpression
to visitpublic void visit(WhenClause expression)
WhenClause
expression.visit
in interface ExpressionVisitor
expression
- The WhenClause
to visitpublic void visit(WhereClause expression)
WhereClause
expression.visit
in interface ExpressionVisitor
expression
- The WhereClause
to visitprotected void visitAbstractConditionalClause(AbstractConditionalClause expression)
protected void visitAbstractDoubleEncapsulatedExpression(AbstractDoubleEncapsulatedExpression expression)
protected void visitAbstractFromClause(AbstractFromClause expression)
protected void visitAbstractSingleEncapsulatedExpression(AbstractSingleEncapsulatedExpression expression)
protected void visitAbstractTripleEncapsulatedExpression(AbstractTripleEncapsulatedExpression expression)
protected void visitCompoundExpression(CompoundExpression expression)