Top Description Fields Constructors Methods
org.eclipse.persistence.jpa.jpql.tools.model.query

public Class LocateExpressionStateObject

extends AbstractTripleEncapsulatedExpressionStateObject
Class Inheritance
Imports
org.eclipse.persistence.jpa.jpql.parser.LocateExpression, .SimpleArithmeticExpressionBNF, .StringPrimaryBNF

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 LENGTH function returns the length of the string in characters as an integer.

BNF: expression ::= LOCATE(string_primary, string_primary [, simple_arithmetic_expression])

Author
Pascal Filion
Since
2.4
Version
2.4
See Also
LocateExpression

Field Summary

Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractTripleEncapsulatedExpressionStateObject:
FIRST_STATE_OBJECT_PROPERTYSECOND_STATE_OBJECT_PROPERTYTHIRD_STATE_OBJECT_PROPERTY

Constructor Summary

AccessConstructor and Description
public
LocateExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
)

Creates a new LocateExpressionStateObject.

public
LocateExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
StateObject
The StateObject of the first expression
firstStateObject
,
StateObject
The StateObject of the second expression
secondStateObject
)

Creates a new LocateExpressionStateObject.

public
LocateExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
StateObject
The StateObject of the first expression
firstStateObject
,
StateObject
The StateObject of the second expression
secondStateObject
,
StateObject
The StateObject of the third encapsulated expression
thirdStateObject
)

Creates a new LocateExpressionStateObject.

public
LocateExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
String
The string representation of the first encapsulated expression to parse and to convert into a StateObject representation
firstJpqlFragment
,
String
The string representation of the second encapsulated expression to parse and to convert into a StateObject representation
secondJpqlFragment
)

Creates a new LocateExpressionStateObject.

public
LocateExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
String
The string representation of the first encapsulated expression to parse and to convert into a StateObject representation
firstJpqlFragment
,
String
The string representation of the second encapsulated expression to parse and to convert into a StateObject representation
secondJpqlFragment
,
String
The string representation of the third encapsulated expression to parse and to convert into a StateObject representation
thirdJpqlFragment
)

Creates a new LocateExpressionStateObject.

Method Summary

Modifier and TypeMethod and Description
public void
public LocateExpression
getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractTripleEncapsulatedExpressionStateObject.getExpression.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

Returns the actual parsed object if this StateObject representation of the JPQL query was created by parsing an existing JPQL query.
protected String
getFirstQueryBNFId()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractTripleEncapsulatedExpressionStateObject.getFirstQueryBNFId.

Returns the unique identifier of the BNF that will be used to parse a JPQL fragment as the first encapsulated expression.
public String
protected String
getSecondQueryBNFId()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractTripleEncapsulatedExpressionStateObject.getSecondQueryBNFId.

Returns the unique identifier of the BNF that will be used to parse a JPQL fragment as the second encapsulated expression.
protected String
getThirdQueryBNFId()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractTripleEncapsulatedExpressionStateObject.getThirdQueryBNFId.

Returns the unique identifier of the BNF that will be used to parse a JPQL fragment as the third encapsulated expression.
public void
setExpression(LocateExpression
The parsed object representing a LOCATE expression
expression
)

Keeps a reference of the parsed object object, which should only be done when this object is instantiated during the conversion of a parsed JPQL query into StateObjects.

Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractTripleEncapsulatedExpressionStateObject:
addChildrengetFirstgetSecondgetThirdhasFirsthasSecondhasThirdisEquivalentparseFirstparseSecondparseThirdsetFirstsetSecondsetThirdtoTextEncapsulatedExpression

Constructor Detail

LocateExpressionStateObjectback to summary
public LocateExpressionStateObject(StateObject parent)

Creates a new LocateExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null
LocateExpressionStateObjectback to summary
public LocateExpressionStateObject(StateObject parent, StateObject firstStateObject, StateObject secondStateObject)

Creates a new LocateExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

firstStateObject:StateObject

The StateObject of the first expression

secondStateObject:StateObject

The StateObject of the second expression

Exceptions
NullPointerException:
The given parent cannot be null
LocateExpressionStateObjectback to summary
public LocateExpressionStateObject(StateObject parent, StateObject firstStateObject, StateObject secondStateObject, StateObject thirdStateObject)

Creates a new LocateExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

firstStateObject:StateObject

The StateObject of the first expression

secondStateObject:StateObject

The StateObject of the second expression

thirdStateObject:StateObject

The StateObject of the third encapsulated expression

Exceptions
NullPointerException:
The given parent cannot be null
LocateExpressionStateObjectback to summary
public LocateExpressionStateObject(StateObject parent, String firstJpqlFragment, String secondJpqlFragment)

Creates a new LocateExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

firstJpqlFragment:String

The string representation of the first encapsulated expression to parse and to convert into a StateObject representation

secondJpqlFragment:String

The string representation of the second encapsulated expression to parse and to convert into a StateObject representation

Exceptions
NullPointerException:
The given parent cannot be null
LocateExpressionStateObjectback to summary
public LocateExpressionStateObject(StateObject parent, String firstJpqlFragment, String secondJpqlFragment, String thirdJpqlFragment)

Creates a new LocateExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

firstJpqlFragment:String

The string representation of the first encapsulated expression to parse and to convert into a StateObject representation

secondJpqlFragment:String

The string representation of the second encapsulated expression to parse and to convert into a StateObject representation

thirdJpqlFragment:String

The string representation of the third encapsulated expression to parse and to convert into a StateObject representation

Exceptions
NullPointerException:
The given parent cannot be null

Method Detail

acceptback to summary
public void accept(StateObjectVisitor visitor)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.accept.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.accept.

Visits this StateObject by the given visitor.

Parameters
visitor:StateObjectVisitor

The visitor to visit this object

Annotations
@Override
getExpressionback to summary
public LocateExpression getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractTripleEncapsulatedExpressionStateObject.getExpression.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

Returns the actual parsed object if this StateObject representation of the JPQL query was created by parsing an existing JPQL query.

Returns:LocateExpression

The parsed object when a JPQL query is parsed and converted into a StateObject or null when the JPQL query is manually created (i.e. not from a string)

Annotations
@Override
getFirstQueryBNFIdback to summary
protected String getFirstQueryBNFId()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractTripleEncapsulatedExpressionStateObject.getFirstQueryBNFId.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractTripleEncapsulatedExpressionStateObject.getFirstQueryBNFId.

Returns the unique identifier of the BNF that will be used to parse a JPQL fragment as the first encapsulated expression.

Returns:String

The query BNF ID for the first encapsulated expression

Annotations
@Override
getIdentifierback to summary
public String getIdentifier()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractEncapsulatedExpressionStateObject.getIdentifier.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractEncapsulatedExpressionStateObject.getIdentifier.

Returns the JPQL identifier of the expression represented by this AbstractSingleEncapsulatedExpressionStateObject.

Returns:String

The JPQL identifier that is shown before the left parenthesis

Annotations
@Override
getSecondQueryBNFIdback to summary
protected String getSecondQueryBNFId()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractTripleEncapsulatedExpressionStateObject.getSecondQueryBNFId.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractTripleEncapsulatedExpressionStateObject.getSecondQueryBNFId.

Returns the unique identifier of the BNF that will be used to parse a JPQL fragment as the second encapsulated expression.

Returns:String

The query BNF ID for the second encapsulated expression

Annotations
@Override
getThirdQueryBNFIdback to summary
protected String getThirdQueryBNFId()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractTripleEncapsulatedExpressionStateObject.getThirdQueryBNFId.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractTripleEncapsulatedExpressionStateObject.getThirdQueryBNFId.

Returns the unique identifier of the BNF that will be used to parse a JPQL fragment as the third encapsulated expression.

Returns:String

The query BNF ID for the third encapsulated expression

Annotations
@Override
setExpressionback to summary
public void setExpression(LocateExpression expression)

Keeps a reference of the parsed object object, which should only be done when this object is instantiated during the conversion of a parsed JPQL query into StateObjects.

Parameters
expression:LocateExpression

The parsed object representing a LOCATE expression