Top Description Fields Constructors Methods
org.eclipse.persistence.jpa.jpql.parser

public final Class AsOfClause

extends AbstractExpression
Class Inheritance
Imports
java.util.Collection, .List, org.eclipse.persistence.jpa.jpql.ExpressionTools, .WordParser

An AS OF clause is part of a flashback query, which provides ways to view past states of database objects, or to return database objects to a previous state, without using traditional point-in-time recovery.

Specify AS OF to retrieve the single version of the rows returned by the query at a particular change number (SCN) or timestamp. If you specify SCN, then the expression must evaluate to a number. If you specify TIMESTAMP, then the expression must evaluate to a timestamp value. Oracle Database returns rows as they existed at the specified system change number or time.

BNF: asof_clause ::= AS OF { SCN | TIMESTAMP } scalar_expression
Author
Pascal Filion
Since
2.5
Version
2.5

Field Summary

Modifier and TypeField and Description
private AbstractExpression
expression

The Expression representing the timestamp or change number.

private boolean
hasSpaceAfterCategory

Determines whether a whitespace was found after either SCN or TIMESTAMP.

private boolean
hasSpaceAfterIdentifier

Determines whether a whitespace was found after AS OF.

private String
identifier

The actual identifier found in the string representation of the JPQL query.

private String
scnIdentifier

The actual SCN identifier found in the string representation of the JPQL query.

private String
timestampIdentifier

The actual TIMESTAMP identifier found in the string representation of the JPQL query.

Inherited from org.eclipse.persistence.jpa.jpql.parser.AbstractExpression:
COMMADOTDOUBLE_QUOTELEFT_CURLY_BRACKETLEFT_PARENTHESISNOT_DEFINEDRIGHT_CURLY_BRACKETRIGHT_PARENTHESISSINGLE_QUOTESPACEUNDERSCORE

Constructor Summary

AccessConstructor and Description
public
AsOfClause(AbstractExpression
The parent of this expression
parent
)

Creates a new AsOfClause.

Method Summary

Modifier and TypeMethod and Description
public void
accept(ExpressionVisitor
The ExpressionVisitor to visit this object
visitor
)

Implements org.eclipse.persistence.jpa.jpql.parser.Expression.accept.

Visits this Expression by the given visitor.
public void
acceptChildren(ExpressionVisitor
The visitor to visit the children of this object.
visitor
)

Implements org.eclipse.persistence.jpa.jpql.parser.Expression.acceptChildren.

Visits the children of this Expression.
protected void
addChildrenTo(Collection<Expression>
The collection used to store the children
children
)

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.addChildrenTo.

Adds the children of this AbstractExpression to the given collection.
protected void
addOrderedChildrenTo(List<Expression>
The list used to store the string representation of this AbstractExpression
children
)

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.addOrderedChildrenTo.

Adds the children of this AbstractExpression to the given list.
public JPQLQueryBNF
findQueryBNF(Expression
The Expression that is a descendant of this one
expression
)

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.findQueryBNF.

Implements org.eclipse.persistence.jpa.jpql.parser.Expression.findQueryBNF.

Retrieves the JPQLQueryBNF that represents the fragment of this Expression that was used when parsing the given Expression.
public String

Returns:

The AS OF identifier that was actually parsed
getActualIdentifier
()

Returns the actual AS OF identifier found in the string representation of the JPQL query, which has the actual case that was used.

public String

Returns:

The SCN identifier that was actually parsed, or an empty string if it was not parsed
getActualScnIdentifier
()

Returns the actual SCN identifier found in the string representation of the JPQL query, which has the actual case that was used.

public String

Returns:

The TIMESTAMP identifier that was actually parsed, or an empty string if it was not parsed
getActualTimestampIdentifier
()

Returns the actual TIMESTAMP identifier found in the string representation of the JPQL query, which has the actual case that was used.

public Expression

Returns:

The Expression that was parsed representing the timestamp or change number
getExpression
()

Returns the Expression representing the timestamp or change number.

public JPQLQueryBNF
public boolean

Returns:

true if the timestamp or change number was parsed; false otherwise
hasExpression
()

Determines whether the Expression representing the timestamp or change number was parsed or not.

public boolean

Returns:

true if the identifier SCN was parsed; false otherwise
hasScn
()

Determines whether the identifier SCN was part of the query.

public boolean

Returns:

true if there was a whitespace after SCN or TIMESTAMP; false otherwise
hasSpaceAfterCategory
()

Determines whether a whitespace was found after either SCN or TIMESTAMP.

public boolean

Returns:

true if there was a whitespace after AS OF; false otherwise
hasSpaceAfterIdentifier
()

Determines whether a whitespace was found after AS OF.

public boolean

Returns:

true if the identifier TIMESTAMP was parsed; false otherwise
hasTimestamp
()

Determines whether the identifier TIMESTAMP was part of the query.

protected void
parse(WordParser
The text to parse based on the current position of the cursor
wordParser
,
boolean
Determines whether the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queries
tolerant
)

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.parse.

Parses the query by starting at the current position, which is part of the given WordParser.
protected void
toParsedText(StringBuilder
The buffer used to append this Expression's string representation
writer
,
boolean
Determines whether the string representation should represent what was parsed, i.e. include any "virtual" whitespace (such as ending whitespace) and the actual case of the JPQL identifiers
actual
)

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.toParsedText.

Generates a string representation of this Expression, including its children, if it has any.
Inherited from org.eclipse.persistence.jpa.jpql.parser.AbstractExpression:
acceptUnknownVisitoracceptUnknownVisitorbuildExpressionFromFallingBackbuildNullExpressionbuildStringExpressionbuildStringExpressionbuildUnknownExpressioncalculatePositionchildrenfindFallBackExpressionFactorygetExpressionFactorygetExpressionRegistrygetGrammargetIdentifierVersiongetJPAVersiongetLengthgetOffsetgetParentgetQueryBNFgetRootgetTexthandleAggregatehandleCollectionisAncestorisIdentifierisNullisParsingCompleteisTolerantisUnknownisVirtualorderedChildrenparseparseUsingExpressionFactorypopulatePositionrebuildActualTextrebuildParsedTextsetParentsetTextshouldParseWithFactoryFirstshouldSkipLiteraltoActualTexttoParsedTexttoString

Field Detail

expressionback to summary
private AbstractExpression expression

The Expression representing the timestamp or change number.

hasSpaceAfterCategoryback to summary
private boolean hasSpaceAfterCategory

Determines whether a whitespace was found after either SCN or TIMESTAMP.

hasSpaceAfterIdentifierback to summary
private boolean hasSpaceAfterIdentifier

Determines whether a whitespace was found after AS OF.

identifierback to summary
private String identifier

The actual identifier found in the string representation of the JPQL query.

scnIdentifierback to summary
private String scnIdentifier

The actual SCN identifier found in the string representation of the JPQL query.

timestampIdentifierback to summary
private String timestampIdentifier

The actual TIMESTAMP identifier found in the string representation of the JPQL query.

Constructor Detail

AsOfClauseback to summary
public AsOfClause(AbstractExpression parent)

Creates a new AsOfClause.

Parameters
parent:AbstractExpression

The parent of this expression

Method Detail

acceptback to summary
public void accept(ExpressionVisitor visitor)

Implements org.eclipse.persistence.jpa.jpql.parser.Expression.accept.

Doc from org.eclipse.persistence.jpa.jpql.parser.Expression.accept.

Visits this Expression by the given visitor.

Parameters
visitor:ExpressionVisitor

The ExpressionVisitor to visit this object

Annotations
@Override
acceptChildrenback to summary
public void acceptChildren(ExpressionVisitor visitor)

Implements org.eclipse.persistence.jpa.jpql.parser.Expression.acceptChildren.

Doc from org.eclipse.persistence.jpa.jpql.parser.Expression.acceptChildren.

Visits the children of this Expression. This method can be used to optimize traversing the children since a new list is not created every time children() is called.

This does not traverse the Expression sub-hierarchy, use a subclass of AbstractTraverseChildrenVisitor in order to traverse the entire sub-hierarchy.

Parameters
visitor:ExpressionVisitor

The visitor to visit the children of this object.

Annotations
@Override
addChildrenToback to summary
protected void addChildrenTo(Collection<Expression> children)

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.addChildrenTo.

Doc from org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.addChildrenTo.

Adds the children of this AbstractExpression to the given collection.

Parameters
children:Collection<Expression>

The collection used to store the children

Annotations
@Override
addOrderedChildrenToback to summary
protected void addOrderedChildrenTo(List<Expression> children)

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.addOrderedChildrenTo.

Doc from org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.addOrderedChildrenTo.

Adds the children of this AbstractExpression to the given list.

Parameters
children:List<Expression>

The list used to store the string representation of this AbstractExpression

Annotations
@Override
findQueryBNFback to summary
public JPQLQueryBNF findQueryBNF(Expression expression)

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.findQueryBNF.

Implements org.eclipse.persistence.jpa.jpql.parser.Expression.findQueryBNF.

Doc from org.eclipse.persistence.jpa.jpql.parser.Expression.findQueryBNF.

Retrieves the JPQLQueryBNF that represents the fragment of this Expression that was used when parsing the given Expression.

Parameters
expression:Expression

The Expression that is a descendant of this one

Returns:JPQLQueryBNF

The JPQLQueryBNF that was used to parse the given expression

Annotations
@Override
getActualIdentifierback to summary
public String getActualIdentifier()

Returns the actual AS OF identifier found in the string representation of the JPQL query, which has the actual case that was used.

Returns:String

The AS OF identifier that was actually parsed

getActualScnIdentifierback to summary
public String getActualScnIdentifier()

Returns the actual SCN identifier found in the string representation of the JPQL query, which has the actual case that was used.

Returns:String

The SCN identifier that was actually parsed, or an empty string if it was not parsed

getActualTimestampIdentifierback to summary
public String getActualTimestampIdentifier()

Returns the actual TIMESTAMP identifier found in the string representation of the JPQL query, which has the actual case that was used.

Returns:String

The TIMESTAMP identifier that was actually parsed, or an empty string if it was not parsed

getExpressionback to summary
public Expression getExpression()

Returns the Expression representing the timestamp or change number.

Returns:Expression

The Expression that was parsed representing the timestamp or change number

getQueryBNFback to summary
public JPQLQueryBNF getQueryBNF()

Implements org.eclipse.persistence.jpa.jpql.parser.Expression.getQueryBNF.

Doc from org.eclipse.persistence.jpa.jpql.parser.Expression.getQueryBNF.

Returns the BNF of this Expression.

Returns:JPQLQueryBNF

The JPQLQueryBNF, which represents the grammar of this Expression

Annotations
@Override
hasExpressionback to summary
public boolean hasExpression()

Determines whether the Expression representing the timestamp or change number was parsed or not.

Returns:boolean

true if the timestamp or change number was parsed; false otherwise

hasScnback to summary
public boolean hasScn()

Determines whether the identifier SCN was part of the query.

Returns:boolean

true if the identifier SCN was parsed; false otherwise

hasSpaceAfterCategoryback to summary
public boolean hasSpaceAfterCategory()

Determines whether a whitespace was found after either SCN or TIMESTAMP.

Returns:boolean

true if there was a whitespace after SCN or TIMESTAMP; false otherwise

hasSpaceAfterIdentifierback to summary
public boolean hasSpaceAfterIdentifier()

Determines whether a whitespace was found after AS OF.

Returns:boolean

true if there was a whitespace after AS OF; false otherwise

hasTimestampback to summary
public boolean hasTimestamp()

Determines whether the identifier TIMESTAMP was part of the query.

Returns:boolean

true if the identifier TIMESTAMP was parsed; false otherwise

parseback to summary
protected void parse(WordParser wordParser, boolean tolerant)

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.parse.

Doc from org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.parse.

Parses the query by starting at the current position, which is part of the given WordParser.

Parameters
wordParser:WordParser

The text to parse based on the current position of the cursor

tolerant:boolean

Determines whether the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queries

Annotations
@Override
toParsedTextback to summary
protected void toParsedText(StringBuilder writer, boolean actual)

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.toParsedText.

Doc from org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.toParsedText.

Generates a string representation of this Expression, including its children, if it has any.

Parameters
writer:StringBuilder

The buffer used to append this Expression's string representation

actual:boolean

Determines whether the string representation should represent what was parsed, i.e. include any "virtual" whitespace (such as ending whitespace) and the actual case of the JPQL identifiers

Annotations
@Override