|
Oracle Fusion Middleware Java API Reference for Oracle TopLink 11g Release 1 (11.1.1) E28847-01 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
org.eclipse.persistence.jpa.internal.jpql.parser.StringExpression
org.eclipse.persistence.jpa.internal.jpql.parser.AbstractExpression
org.eclipse.persistence.jpa.internal.jpql.parser.CollectionExpression
public final class CollectionExpression
A CollectionExpression wraps many expression which they are separated by spaces and/or commas.
expression ::= child_item {, child_item }*expression ::= child_item { child_item }*
| Field Summary | |
|---|---|
private java.util.List<AbstractExpression> |
childrenThe Expressions that forms a collection within another expression. |
private java.util.List<java.lang.Boolean> |
commasThe list of flags used to determine where to separate two child Expressions with a comma or with a space only. |
private java.util.List<java.lang.Boolean> |
spacesFlag used to determine when a space is required after a comma. |
| Fields inherited from class org.eclipse.persistence.jpa.internal.jpql.parser.AbstractExpression |
|---|
COMMA, DOT, DOUBLE_QUOTE, LEFT_CURLY_BRACKET, LEFT_PARENTHESIS, NOT_DEFINED, RIGHT_CURLY_BRACKET, RIGHT_PARENTHESIS, SINGLE_QUOTE, SPACE, UNDERSCORE |
| Constructor Summary | |
|---|---|
CollectionExpression(AbstractExpression parent, java.util.List<AbstractExpression> children, java.util.List<java.lang.Boolean> commas, java.util.List<java.lang.Boolean> spaces)Creates a new CollectionExpression. |
|
CollectionExpression(AbstractExpression parent, java.util.List<AbstractExpression> children, java.util.List<java.lang.Boolean> commas, java.util.List<java.lang.Boolean> spaces, boolean temporary)Creates a new CollectionExpression. |
|
| Method Summary | |
|---|---|
void |
accept(ExpressionVisitor visitor)Visits this Expression by the given visitor. |
void |
acceptChildren(ExpressionVisitor visitor)Visits the children of this Expression. |
(package private) void |
addChildrenTo(java.util.Collection<Expression> children)Adds the children of this Expression to the given collection. |
(package private) void |
addOrderedChildrenTo(java.util.List<StringExpression> children)Adds the StringExpressions representing this Expression. |
int |
childrenSize()Returns the count of child expressions. |
boolean |
endsWithComma()Determines whether this CollectionExpression ends with a comma, which means the last Expression is a "null" expression. |
boolean |
endsWithSpace()Determines whether this CollectionExpression ends with a space, which means the last Expression is a "null" expression. |
JPQLQueryBNF |
findQueryBNF(AbstractExpression expression)Retrieves the JPQLQueryBNF that was used to parse the given Expression. |
Expression |
getChild(int index)Retrieves the child Expression at the given position. |
private AbstractExpression |
getChildInternal(int index) |
JPQLQueryBNF |
getQueryBNF()Returns the BNF of this Expression. |
boolean |
hasComma(int index)Determines whether a comma was parsed at the given position. |
boolean |
hasSpace(int index)Determines whether a space was parsed at the given position. |
int |
indexOf(Expression expression)Retrieves the index of the given Expression. |
(package private) void |
parse(WordParser wordParser, boolean tolerant)Parses the query by starting at the current position, which is part of the given WordParser. |
java.lang.String |
toActualText(int endIndex)Returns a string representation of this Expression and its children. |
java.lang.String |
toParsedText(int endIndex)Generates a string representation of this CollectionExpression. |
(package private) void |
toParsedText(java.lang.StringBuilder writer, boolean includeVirtual)Generates a string representation of this Expression. |
private void |
toParsedText(java.lang.StringBuilder writer, int endIndex, boolean includeVirtual) |
private void |
updateBackpointers() |
| Methods inherited from class org.eclipse.persistence.jpa.internal.jpql.parser.AbstractExpression |
|---|
buildExpressionFromFallingBack, buildNullExpression, buildStringExpression, buildStringExpression, buildUnknownExpression, children, expressionFactory, expressionFactoryForIdentifier, getChildren, getJPAVersion, getParent, getRoot, getText, handleAggregate, identifierRole, identifiers, identifiers, identifierVersion, isAncestor, isIdentifier, isNull, isParsingComplete, isTolerant, isUnknown, isVirtual, orderedChildren, parse, parseSingleExpression, populatePosition, queryBNF, readdLeadingSpaces, rebuildActualText, rebuildParsedText, setParent, setText, shouldParseWithFactoryFirst, shouldSkipLiteral, toActualText, toParsedText, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private java.util.List<AbstractExpression> children
Expressions that forms a collection within another expression.private java.util.List<java.lang.Boolean> commas
Expressions with a comma or with a space only.private java.util.List<java.lang.Boolean> spaces
| Constructor Detail |
|---|
CollectionExpression(AbstractExpression parent, java.util.List<AbstractExpression> children, java.util.List<java.lang.Boolean> commas, java.util.List<java.lang.Boolean> spaces)
CollectionExpression.
parent - The parent of this expressionchildren - The list of children that are regrouped togetherspaces - The list of flags used to determine when to add a space after an Expressioncommas - The list of flags used to determine when to add a comma after an ExpressionCollectionExpression(AbstractExpression parent, java.util.List<AbstractExpression> children, java.util.List<java.lang.Boolean> commas, java.util.List<java.lang.Boolean> spaces, boolean temporary)
CollectionExpression.
parent - The parent of this expressionchildren - The list of children that are regrouped togethercommas - The list of flags used to determine when to add a comma after an Expressionspaces - The list of flags used to determine when to add a space after an Expressiontemporary - Flag used to determine if this expression is temporarily used, which means the children will not be parented to this object| Method Detail |
|---|
public void accept(ExpressionVisitor visitor)
Expression by the given visitor.visitor - The visitor to visit this objectpublic void acceptChildren(ExpressionVisitor visitor)
Expression. This method can be used to optimize traversing the children since a new list is not created every time Expression.children() or Expression.getChildren() is called.
This does not traverse the Expression sub-hierarchy, use an subclass of AbstractTraverseChildrenVisitor in order to traverse the entire sub-hierarchy.
visitor - The visitor to visit the children of this object.void addChildrenTo(java.util.Collection<Expression> children)
Expression to the given collection.addChildrenTo in class AbstractExpressionchildren - The collection used to store the childrenvoid addOrderedChildrenTo(java.util.List<StringExpression> children)
StringExpressions representing this Expression.addOrderedChildrenTo in class AbstractExpressionchildren - The list used to store the string representation of this Expressionpublic int childrenSize()
expressions.expressions aggregated with spaces and/or commaspublic boolean endsWithComma()
CollectionExpression ends with a comma, which means the last Expression is a "null" expression.true if the string representation of this CollectionExpression ends with a comma (the ending space is not checked)public boolean endsWithSpace()
CollectionExpression ends with a space, which means the last Expression is a "null" expression.true if the string representation of this CollectionExpression ends with a space (the ending comma is not checked)public JPQLQueryBNF findQueryBNF(AbstractExpression expression)
JPQLQueryBNF that was used to parse the given Expression.findQueryBNF in class AbstractExpressionexpression - The expression for which its BNF is neededJPQLQueryBNF that was used to parse the given expressionpublic Expression getChild(int index)
Expression at the given position.index - The position of the child Expression to retrieveExpression at the given positionprivate AbstractExpression getChildInternal(int index)
public JPQLQueryBNF getQueryBNF()
Expression.getQueryBNF in class AbstractExpressionJPQLQueryBNF, which represents the grammar of this Expressionpublic boolean hasComma(int index)
index - The index of the child Expression to verify if there is a comma following ittrue if a comma is following the child Expression at the given index; false otherwisepublic boolean hasSpace(int index)
index - The index of the child Expression to verify if there is a space following it, which could be after a comma, if one was parsedtrue if a space is following the child Expression at the given index; false otherwisepublic int indexOf(Expression expression)
Expression.expression - The Expression that might be a child of this expressionExpression or -1 if it is not a childvoid parse(WordParser wordParser, boolean tolerant)
WordParser.parse in class AbstractExpressionwordParser - The text to parse based on the current position of the cursortolerant - Determines whether the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queriespublic java.lang.String toActualText(int endIndex)
Expression and its children. The expression should contain whitespace even if the beautified version would not have any. For instance, "SELECT e " should be returned where Expression#toText() would return "SELECT e".endIndex - The index used to determine when to create the string representation, which is exclusivewriter - The buffer used to append this CollectionExpression's string representationExpressionpublic java.lang.String toParsedText(int endIndex)
CollectionExpression.endIndex - The index used to determine when to create the string representation, which is exclusivewriter - The buffer used to append this CollectionExpression's string representationExpression
void toParsedText(java.lang.StringBuilder writer,
boolean includeVirtual)
Expression.toParsedText in class AbstractExpressionwriter - The buffer used to append this Expression's string representationincludeVirtual - Determines whether to include any characters that are considered virtual, i.e. that was parsed when the query is incomplete and is needed for functionality like content assist
private void toParsedText(java.lang.StringBuilder writer,
int endIndex,
boolean includeVirtual)
private void updateBackpointers()
|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||