Class AbstractContentAssistVisitor.DoubleEncapsulatedCollectionHelper
java.lang.Object
org.eclipse.persistence.jpa.jpql.tools.AbstractContentAssistVisitor.DoubleEncapsulatedCollectionHelper
- All Implemented Interfaces:
AbstractContentAssistVisitor.CollectionExpressionHelper<AbstractDoubleEncapsulatedExpression>
- Enclosing class:
AbstractContentAssistVisitor
protected static final class AbstractContentAssistVisitor.DoubleEncapsulatedCollectionHelper
extends Object
implements AbstractContentAssistVisitor.CollectionExpressionHelper<AbstractDoubleEncapsulatedExpression>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AbstractContentAssistVisitorEnclosing visitor instance. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAtTheEndOfChild(AbstractDoubleEncapsulatedExpression expression, CollectionExpression collectionExpression, int index, boolean hasComma, boolean virtualSpace) Adds the proposals because the cursor is at the end of the child at the given position.voidaddIdentifier(AbstractDoubleEncapsulatedExpression expression, String identifier) Adds the given JPQL identifier as a valid proposal.voidaddTheBeginningOfChild(AbstractDoubleEncapsulatedExpression expression, CollectionExpression collectionExpression, int index, boolean hasComma) Adds the proposals because the cursor is at the beginning of the childExpressionat the given position.Either returns the givenExpression's child, which is already aCollectionExpressionor requests this helper to return a "virtual"CollectionExpressionthat is wrapping the single element.booleancanContinue(AbstractDoubleEncapsulatedExpression expression, CollectionExpression collectionExpression, int index) Asks this helper if the search can continue even though two child expressions are not separated by a comma.booleanDetermines whether a delimiter like a whitespace or an open parenthesis was parsed after the identifier.intReturns the maximum number of encapsulatedexpressionstheExpressionallows.intReturns the length of anything that can be defined before the first child.queryBNF(AbstractDoubleEncapsulatedExpression expression, int index) Returns theJPQLQueryBNFthat defines the fragment at the given position.
-
Field Details
-
visitor
Enclosing visitor instance.
-
-
Constructor Details
-
DoubleEncapsulatedCollectionHelper
-
-
Method Details
-
addAtTheEndOfChild
public void addAtTheEndOfChild(AbstractDoubleEncapsulatedExpression expression, CollectionExpression collectionExpression, int index, boolean hasComma, boolean virtualSpace) Description copied from interface:AbstractContentAssistVisitor.CollectionExpressionHelperAdds the proposals because the cursor is at the end of the child at the given position.- Specified by:
addAtTheEndOfChildin interfaceAbstractContentAssistVisitor.CollectionExpressionHelper<AbstractDoubleEncapsulatedExpression>- Parameters:
expression- TheExpressionbeing visitedcollectionExpression- TheCollectionExpressionis either the child of the givenExpressionor a temporary generated one that usually contains a single itemindex- The position of that child in the collection of childrenhasComma- Indicates whether a comma is present before the child at the given position; if the index is 0, then this isfalseby defaultvirtualSpace- Indicates if this method is called because the cursor is at the end of the child at the specified index but by considering there is a virtual space at the end of that child
-
addIdentifier
Description copied from interface:AbstractContentAssistVisitor.CollectionExpressionHelperAdds the given JPQL identifier as a valid proposal.- Specified by:
addIdentifierin interfaceAbstractContentAssistVisitor.CollectionExpressionHelper<AbstractDoubleEncapsulatedExpression>- Parameters:
expression- TheExpressionbeing visitedidentifier- The JPQL identifier to add as a valid proposal
-
addTheBeginningOfChild
public void addTheBeginningOfChild(AbstractDoubleEncapsulatedExpression expression, CollectionExpression collectionExpression, int index, boolean hasComma) Description copied from interface:AbstractContentAssistVisitor.CollectionExpressionHelperAdds the proposals because the cursor is at the beginning of the childExpressionat the given position.- Specified by:
addTheBeginningOfChildin interfaceAbstractContentAssistVisitor.CollectionExpressionHelper<AbstractDoubleEncapsulatedExpression>- Parameters:
expression- TheExpressionbeing visitedcollectionExpression- TheCollectionExpressionis either the child of the givenExpressionor a temporary generated one that usually contains a single item. This can be null if the position is at the beginningindex- The position of the child that was scannedhasComma- Indicates whether a comma is present before the child at the given position; if the index is 0, then this isfalseby default
-
buildCollectionExpression
public CollectionExpression buildCollectionExpression(AbstractDoubleEncapsulatedExpression expression) Description copied from interface:AbstractContentAssistVisitor.CollectionExpressionHelperEither returns the givenExpression's child, which is already aCollectionExpressionor requests this helper to return a "virtual"CollectionExpressionthat is wrapping the single element.- Specified by:
buildCollectionExpressionin interfaceAbstractContentAssistVisitor.CollectionExpressionHelper<AbstractDoubleEncapsulatedExpression>- Parameters:
expression- The parent of the children to retrieve- Returns:
- The given expression's child or a "virtual" one
-
canContinue
public boolean canContinue(AbstractDoubleEncapsulatedExpression expression, CollectionExpression collectionExpression, int index) Description copied from interface:AbstractContentAssistVisitor.CollectionExpressionHelperAsks this helper if the search can continue even though two child expressions are not separated by a comma.- Specified by:
canContinuein interfaceAbstractContentAssistVisitor.CollectionExpressionHelper<AbstractDoubleEncapsulatedExpression>- Parameters:
expression- TheExpressionbeing visitedcollectionExpression- TheCollectionExpressionindex- The position of the child being scanned- Returns:
trueif the check can continue even though the previous child was not separated by a comma;falseto stop the check
-
hasDelimiterAfterIdentifier
Description copied from interface:AbstractContentAssistVisitor.CollectionExpressionHelperDetermines whether a delimiter like a whitespace or an open parenthesis was parsed after the identifier.- Specified by:
hasDelimiterAfterIdentifierin interfaceAbstractContentAssistVisitor.CollectionExpressionHelper<AbstractDoubleEncapsulatedExpression>- Parameters:
expression- TheExpressionbeing visited- Returns:
trueif something is present;falseotherwise
-
maxCollectionSize
Description copied from interface:AbstractContentAssistVisitor.CollectionExpressionHelperReturns the maximum number of encapsulatedexpressionstheExpressionallows. Some expression only allow 2, others 3 and others allow an unlimited number.- Specified by:
maxCollectionSizein interfaceAbstractContentAssistVisitor.CollectionExpressionHelper<AbstractDoubleEncapsulatedExpression>- Parameters:
expression- TheExpressionfor which its maximum number of children- Returns:
- The maximum number of children the expression can have
-
preExpressionLength
Description copied from interface:AbstractContentAssistVisitor.CollectionExpressionHelperReturns the length of anything that can be defined before the first child. An example can be "DISTINCT" in "AVG(DISTINCT e.name)".- Specified by:
preExpressionLengthin interfaceAbstractContentAssistVisitor.CollectionExpressionHelper<AbstractDoubleEncapsulatedExpression>- Parameters:
expression- TheExpressionbeing visited- Returns:
- The length of anything that was parsed before the first child or 0 if nothing was parsed
-
queryBNF
Description copied from interface:AbstractContentAssistVisitor.CollectionExpressionHelperReturns theJPQLQueryBNFthat defines the fragment at the given position.- Specified by:
queryBNFin interfaceAbstractContentAssistVisitor.CollectionExpressionHelper<AbstractDoubleEncapsulatedExpression>- Parameters:
expression- TheExpressionbeing visitedindex- The position of the element to retrieve the BNF defined in the JPQL grammar- Returns:
- The
JPQLQueryBNFthat defines the fragment at the given position
-