Class AbstractContentAssistVisitor.AbstractConditionalClauseCollectionHelper<T extends Expression>
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.AbstractContentAssistVisitor.AbstractConditionalClauseCollectionHelper<T>
-
- All Implemented Interfaces:
AbstractContentAssistVisitor.CollectionExpressionHelper<T>
- Direct Known Subclasses:
AbstractContentAssistVisitor.ConditionalClauseCollectionHelper,AbstractContentAssistVisitor.WhenClauseConditionalClauseCollectionHelper
- Enclosing class:
- AbstractContentAssistVisitor
protected abstract static class AbstractContentAssistVisitor.AbstractConditionalClauseCollectionHelper<T extends Expression> extends java.lang.Object implements AbstractContentAssistVisitor.CollectionExpressionHelper<T>
This helper handles adding proposals within a conditional expression that might be parsed as a single expression or has a collection of expression, which means the fragment is either incomplete or invalid.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractConditionalClauseCollectionHelper(AbstractContentAssistVisitor visitor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAtTheEndOfChild(Expression 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(Expression expression, java.lang.String identifier)Adds the given JPQL identifier as a valid proposal.voidaddTheBeginningOfChild(Expression expression, CollectionExpression collectionExpression, int index, boolean hasComma)Adds the proposals because the cursor is at the beginning of the childExpressionat the given position.booleancanContinue(Expression expression, CollectionExpression collectionExpression, int index)Asks this helper if the search can continue even though two child expressions are not separated by a comma.protected java.lang.Object[]findChild(CollectionExpression collectionExpression, int index)Handles a special case for a compound identifier like 'IS EMPTY' or 'IS NOT EMPTY'.intmaxCollectionSize(Expression expression)Returns the maximum number of encapsulatedexpressionstheExpressionallows.intpreExpressionLength(Expression expression)Returns the length of anything that can be defined before the first child.JPQLQueryBNFqueryBNF(Expression expression, int index)Returns theJPQLQueryBNFthat defines the fragment at the given position.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.persistence.jpa.jpql.tools.AbstractContentAssistVisitor.CollectionExpressionHelper
buildCollectionExpression, hasDelimiterAfterIdentifier
-
-
-
-
Constructor Detail
-
AbstractConditionalClauseCollectionHelper
protected AbstractConditionalClauseCollectionHelper(AbstractContentAssistVisitor visitor)
-
-
Method Detail
-
addAtTheEndOfChild
public void addAtTheEndOfChild(Expression 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.- Specified by:
addAtTheEndOfChildin interfaceAbstractContentAssistVisitor.CollectionExpressionHelper<T extends Expression>- 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
public void addIdentifier(Expression expression, java.lang.String identifier)
Adds the given JPQL identifier as a valid proposal.- Specified by:
addIdentifierin interfaceAbstractContentAssistVisitor.CollectionExpressionHelper<T extends Expression>- Parameters:
expression- TheExpressionbeing visitedidentifier- The JPQL identifier to add as a valid proposal
-
addTheBeginningOfChild
public void addTheBeginningOfChild(Expression expression, CollectionExpression collectionExpression, int index, boolean hasComma)
Adds the proposals because the cursor is at the beginning of the childExpressionat the given position.- Specified by:
addTheBeginningOfChildin interfaceAbstractContentAssistVisitor.CollectionExpressionHelper<T extends Expression>- 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
-
canContinue
public boolean canContinue(Expression expression, CollectionExpression collectionExpression, int index)
Asks this helper if the search can continue even though two child expressions are not separated by a comma.- Specified by:
canContinuein interfaceAbstractContentAssistVisitor.CollectionExpressionHelper<T extends Expression>- 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
-
findChild
protected java.lang.Object[] findChild(CollectionExpression collectionExpression, int index)
Handles a special case for a compound identifier like 'IS EMPTY' or 'IS NOT EMPTY'.- Parameters:
collectionExpression- TheCollectionExpressionis used to find theExpressionto use when filtering out compound identifierindex- The position to start the search, which goes from that index to the beginning- Returns:
- An array of three elements. The first one is the child
Expressionthat can be used when filtering out compound identifier. The second boolean element indicates ifISwas detected after the child. The third boolean element indicates ifNOTwas detected after the child, which would also be afterISif it was detected.nullis returned if nothing could be found
-
maxCollectionSize
public int maxCollectionSize(Expression expression)
Returns the maximum number of encapsulatedexpressionstheExpressionallows. Some expression only allow 2, others 3 and others allow an unlimited number.- Specified by:
maxCollectionSizein interfaceAbstractContentAssistVisitor.CollectionExpressionHelper<T extends Expression>- Parameters:
expression- TheExpressionfor which its maximum number of children- Returns:
- The maximum number of children the expression can have
-
preExpressionLength
public int preExpressionLength(Expression expression)
Returns 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<T extends Expression>- Parameters:
expression- TheExpressionbeing visited- Returns:
- The length of anything that was parsed before the first child or 0 if nothing was parsed
-
queryBNF
public JPQLQueryBNF queryBNF(Expression expression, int index)
Returns theJPQLQueryBNFthat defines the fragment at the given position.- Specified by:
queryBNFin interfaceAbstractContentAssistVisitor.CollectionExpressionHelper<T extends Expression>- 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
-
-