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

public abstract Class AbstractSingleEncapsulatedExpressionStateObject

extends AbstractEncapsulatedExpressionStateObject
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.jpa.jpql.tools.model.query.AggregateFunctionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.AllOrAnyExpressionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.EncapsulatedIdentificationVariableExpressionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.ExistsExpressionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.LengthExpressionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.LowerExpressionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.SizeExpressionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.SqrtExpressionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.SubExpressionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.TrimExpressionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.TypeExpressionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.UpperExpressionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.AbsExpressionStateObject
Annotations
@SuppressWarnings:nls
Imports
java.io.IOException, java.util.List, org.eclipse.persistence.jpa.jpql.parser.AbstractSingleEncapsulatedExpression

This StateObject represents a JPQL expression that has a JPQL identifier followed by an encapsulated expression with parenthesis.

BNF: expression ::= <identifier>(expression)

Author
Pascal Filion
Since
2.4
Version
2.4
See Also
AbstractSingleEncapsulatedExpression

Field Summary

Modifier and TypeField and Description
public static final String
STATE_OBJECT_PROPERTY

Notifies the encapsulated StateObject has changed.

private StateObject
stateObject

The StateObject representing the encapsulated expression.

Constructor Summary

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

Creates a new AbstractSingleEncapsulatedExpressionStateObject.

protected
AbstractSingleEncapsulatedExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
StateObject
The StateObject representing the encapsulated expression
stateObject
)

Creates a new AbstractSingleEncapsulatedExpressionStateObject.

protected
AbstractSingleEncapsulatedExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
String
The portion of the query representing the encapsulated expression
jpqlFragment
)

Creates a new AbstractSingleEncapsulatedExpressionStateObject.

Method Summary

Modifier and TypeMethod and Description
protected void
addChildren(List<StateObject>
The list used to store the children
children
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.addChildren.

Adds the children of this StateObject to the given list.
public AbstractSingleEncapsulatedExpression
getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractEncapsulatedExpressionStateObject.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 abstract String

Returns:

The non-null ID of the BNF
getQueryBNFId
()

Returns the unique identifier of the JPQLQueryBNF that will determine how to parse the encapsulated expression.

public StateObject

Returns:

The encapsulated StateObject
getStateObject
()

Returns the encapsulated StateObject.

public boolean

Returns:

true if the encapsulated StateObject is not null; false otherwise
hasStateObject
()

Determines whether the StateObject representing the encapsulated expression is present or not.

public boolean
isEquivalent(StateObject
The StateObject to compare its content to this one
stateObject
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.isEquivalent.

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

Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.
public void
parse(String
The portion of the query representing the encapsulated expression
jpqlFragment
)

Parses the given JPQL fragment, which represents the encapsulated expression, and creates the StateObject.

protected void
setStateObject(StateObject
The new encapsulated StateObject
stateObject
)

Sets the given StateObject to represent the new encapsulated expression.

protected void
toTextEncapsulatedExpression(Appendable
The writer used to print out the string representation of the encapsulated information
writer
)

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

Prints out a string representation of this encapsulated information, which should not be used to define a true string representation of a JPQL query but should be used for debugging purposes.
Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractEncapsulatedExpressionStateObject:
getIdentifiertoTextInternal

Field Detail

STATE_OBJECT_PROPERTYback to summary
public static final String STATE_OBJECT_PROPERTY

Notifies the encapsulated StateObject has changed.

stateObjectback to summary
private StateObject stateObject

The StateObject representing the encapsulated expression.

Constructor Detail

AbstractSingleEncapsulatedExpressionStateObjectback to summary
protected AbstractSingleEncapsulatedExpressionStateObject(StateObject parent)

Creates a new AbstractSingleEncapsulatedExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null
AbstractSingleEncapsulatedExpressionStateObjectback to summary
protected AbstractSingleEncapsulatedExpressionStateObject(StateObject parent, StateObject stateObject)

Creates a new AbstractSingleEncapsulatedExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

stateObject:StateObject

The StateObject representing the encapsulated expression

Exceptions
NullPointerException:
The given parent cannot be null
AbstractSingleEncapsulatedExpressionStateObjectback to summary
protected AbstractSingleEncapsulatedExpressionStateObject(StateObject parent, String jpqlFragment)

Creates a new AbstractSingleEncapsulatedExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

jpqlFragment:String

The portion of the query representing the encapsulated expression

Exceptions
NullPointerException:
The given parent cannot be null

Method Detail

addChildrenback to summary
protected void addChildren(List<StateObject> children)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.addChildren.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.addChildren.

Adds the children of this StateObject to the given list.

Parameters
children:List<StateObject>

The list used to store the children

Annotations
@Override
getExpressionback to summary
public AbstractSingleEncapsulatedExpression getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractEncapsulatedExpressionStateObject.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:AbstractSingleEncapsulatedExpression

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
getQueryBNFIdback to summary
protected abstract String getQueryBNFId()

Returns the unique identifier of the JPQLQueryBNF that will determine how to parse the encapsulated expression.

Returns:String

The non-null ID of the BNF

getStateObjectback to summary
public StateObject getStateObject()

Returns the encapsulated StateObject.

Returns:StateObject

The encapsulated StateObject

hasStateObjectback to summary
public boolean hasStateObject()

Determines whether the StateObject representing the encapsulated expression is present or not.

Returns:boolean

true if the encapsulated StateObject is not null; false otherwise

isEquivalentback to summary
public boolean isEquivalent(StateObject stateObject)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.isEquivalent.

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

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

Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.

Parameters
stateObject:StateObject

The StateObject to compare its content to this one

Returns:boolean

true if both object are equivalent; false otherwise

Annotations
@Override
parseback to summary
public void parse(String jpqlFragment)

Parses the given JPQL fragment, which represents the encapsulated expression, and creates the StateObject.

Parameters
jpqlFragment:String

The portion of the query representing the encapsulated expression

setStateObjectback to summary
protected void setStateObject(StateObject stateObject)

Sets the given StateObject to represent the new encapsulated expression.

Parameters
stateObject:StateObject

The new encapsulated StateObject

toTextEncapsulatedExpressionback to summary
protected void toTextEncapsulatedExpression(Appendable writer) throws IOException

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

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

Prints out a string representation of this encapsulated information, which should not be used to define a true string representation of a JPQL query but should be used for debugging purposes.

Parameters
writer:Appendable

The writer used to print out the string representation of the encapsulated information

Annotations
@Override
Exceptions
IOException:
This should never happens, only required because Appendable is used instead of StringBuilder for instance