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

public final Class QueryPosition

extends Object
Class Inheritance
Imports
java.util.HashMap, .Map

This object contains the cursor position within the parsed tree and within each of the Expression from the root to the deepest leaf.
Author
Pascal Filion
Since
2.3
Version
2.5

Field Summary

Modifier and TypeField and Description
private Expression
expression

The deepest child Expression where the position of the cursor is.

private int
position

The position of the cursor in the query.

private Map<Expression, Integer>
positions

The table containing the position of each of the Expression up to the deepest leaf.

Constructor Summary

AccessConstructor and Description
public
QueryPosition(int
The position of the cursor in the query
position
)

Creates a new QueryPosition.

Method Summary

Modifier and TypeMethod and Description
public void
addPosition(Expression
An Expression in which the cursor is located
expression
,
int
The position of the cursor within the given Expression
position
)

Adds the position of the cursor within the given Expression

public Expression

Returns:

The deepest Expression child that was retrieving by traversing the parsed tree up to the position of the cursor.
getExpression
()

Returns the child Expression where the position of the cursor is.

public int

Returns:

The position of the cursor in the query
getPosition
()

Returns the position of the cursor in the query.

public int

Returns:

Either the position of the cursor within the given Expression or -1 if the cursor is not within it
getPosition
(Expression
The Expression for which the position of the cursor is requested
expression
)

Returns the position of the cursor within the given Expression

public void
setExpression(Expression
The Expression that is the deepest leaf within the parsed tree
expression
)

Sets the deepest leaf where the cursor is located.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

expressionback to summary
private Expression expression

The deepest child Expression where the position of the cursor is.

positionback to summary
private int position

The position of the cursor in the query.

positionsback to summary
private Map<Expression, Integer> positions

The table containing the position of each of the Expression up to the deepest leaf.

Constructor Detail

QueryPositionback to summary
public QueryPosition(int position)

Creates a new QueryPosition.

Parameters
position:int

The position of the cursor in the query

Method Detail

addPositionback to summary
public void addPosition(Expression expression, int position)

Adds the position of the cursor within the given Expression

Parameters
expression:Expression

An Expression in which the cursor is located

position:int

The position of the cursor within the given Expression

getExpressionback to summary
public Expression getExpression()

Returns the child Expression where the position of the cursor is.

Returns:Expression

The deepest Expression child that was retrieving by traversing the parsed tree up to the position of the cursor.

getPositionback to summary
public int getPosition()

Returns the position of the cursor in the query.

Returns:int

The position of the cursor in the query

getPositionback to summary
public int getPosition(Expression expression)

Returns the position of the cursor within the given Expression

Parameters
expression:Expression

The Expression for which the position of the cursor is requested

Returns:int

Either the position of the cursor within the given Expression or -1 if the cursor is not within it

setExpressionback to summary
public void setExpression(Expression expression)

Sets the deepest leaf where the cursor is located.

Parameters
expression:Expression

The Expression that is the deepest leaf within the parsed tree

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override