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

public final Class LocateExpression

extends AbstractTripleEncapsulatedExpression
Class Inheritance

The LOCATE function returns the position of a given string within a string, starting the search at a specified position. It returns the first position at which the string was found as an integer. The first argument is the string to be located; the second argument is the string to be searched; the optional third argument is an integer that represents the string position at which the search is started (by default, the beginning of the string to be searched). The first position in a string is denoted by 1. If the string is not found, 0 is returned. The LOCATE function returns the length of the string in characters as an integer.
JPA 1.0, 2.0:
BNF: expression ::= LOCATE(string_primary, string_primary [, simple_arithmetic_expression])

JPA 2.1:
BNF: expression ::= LOCATE(string_expression, string_expression [, arithmetic_expression])
Author
Pascal Filion
Since
2.3
Version
2.5

Field Summary

Inherited from org.eclipse.persistence.jpa.jpql.parser.AbstractTripleEncapsulatedExpression:
parameterIndex

Constructor Summary

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

Creates a new LocateExpression.

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 String
getParameterQueryBNFId(int
The position of the encapsulated Expression that needs to be parsed within the parenthesis, which starts at position 0
index
)

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractTripleEncapsulatedExpression.getParameterQueryBNFId.

Returns the unique identifier of the JPQLQueryBNF to be used to parse one of the encapsulated expression at the given position.
public JPQLQueryBNF
protected boolean
isThirdExpressionOptional()

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractTripleEncapsulatedExpression.isThirdExpressionOptional.

Determines whether the third expression is an optional expression, which means a valid query can have it or not.
Inherited from org.eclipse.persistence.jpa.jpql.parser.AbstractTripleEncapsulatedExpression:
acceptChildrenaddChildrenToaddOrderedEncapsulatedExpressionTobuildCollectionExpressionfindQueryBNFgetFirstExpressiongetSecondExpressiongetThirdExpressionhasEncapsulatedExpressionhasFirstCommahasFirstExpressionhasSecondCommahasSecondExpressionhasSpaceAfterFirstCommahasSpaceAfterSecondCommahasThirdExpressionisParsingCompleteparseEncapsulatedExpressionremoveEncapsulatedExpressiontoParsedTextEncapsulatedExpression

Constructor Detail

LocateExpressionback to summary
public LocateExpression(AbstractExpression parent)

Creates a new LocateExpression.

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
getParameterQueryBNFIdback to summary
public String getParameterQueryBNFId(int index)

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractTripleEncapsulatedExpression.getParameterQueryBNFId.

Doc from org.eclipse.persistence.jpa.jpql.parser.AbstractTripleEncapsulatedExpression.getParameterQueryBNFId.

Returns the unique identifier of the JPQLQueryBNF to be used to parse one of the encapsulated expression at the given position.

Parameters
index:int

The position of the encapsulated Expression that needs to be parsed within the parenthesis, which starts at position 0

Returns:String

The ID of the JPQLQueryBNF to be used to parse one of the encapsulated expression

Annotations
@Override
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
isThirdExpressionOptionalback to summary
protected boolean isThirdExpressionOptional()

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractTripleEncapsulatedExpression.isThirdExpressionOptional.

Doc from org.eclipse.persistence.jpa.jpql.parser.AbstractTripleEncapsulatedExpression.isThirdExpressionOptional.

Determines whether the third expression is an optional expression, which means a valid query can have it or not.

Returns:boolean

true if the third expression can either be present or not in a valid query; false if it's mandatory

Annotations
@Override