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

public abstract Class CompoundExpressionStateObject

extends AbstractStateObject
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.jpa.jpql.tools.model.query.LogicalExpressionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.ArithmeticExpressionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.ComparisonExpressionStateObject
Annotations
@SuppressWarnings:nls
Imports
java.io.IOException, java.util.List, org.eclipse.persistence.jpa.jpql.parser.CompoundExpression

A compound StateObject has a left and right expressions combined by an identifier.

BNF: expression ::= left_expression <identifier> right_expression

Author
Pascal Filion
Since
2.4
Version
2.4
See Also
CompoundExpression

Field Summary

Modifier and TypeField and Description
public static final String
LEFT_STATE_OBJECT_PROPERTY

Notifies the left state object property has changed.

private StateObject
leftStateObject

The StateObject representing the left expression.

public static final String
RIGHT_STATE_OBJECT_PROPERTY

Notifies the right state object property has changed.

private StateObject
rightStateObject

The StateObject representing the right expression.

Constructor Summary

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

Creates a new CompoundExpressionStateObject.

protected
CompoundExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
StateObject
The StateObject representing the left expression
leftStateObject
,
StateObject
The StateObject representing the right expression
rightStateObject
)

Creates a new ArithmeticExpressionStateObject.

protected
CompoundExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
String
The string representation of the left expression to parse and to convert into a StateObject
leftJpqlFragment
,
String
The string representation of the right expression to parse and to convert into a StateObject
rightJpqlFragment
)

Creates a new ArithmeticExpressionStateObject.

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 CompoundExpression
getExpression()

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

Returns:

The JPQL identifier join two expressions
getIdentifier
()

Returns the identifier joining the two StateObjects.

public StateObject

Returns:

The StateObject representing the left expression
getLeft
()

Returns the StateObject that represents the left expression.

protected abstract String

Returns:

The query BNF ID for the left side of the expression
getLeftQueryBNFId
()

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

public StateObject

Returns:

The StateObject representing the right expression
getRight
()

Returns the StateObject that represents the right expression.

protected abstract String

Returns:

The query BNF ID for the right side of the expression
getRightQueryBNFId
()

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

public boolean

Returns:

true if there is a left StateObject; false if it is null
hasLeft
()

Determines whether there is a StateObject that represents the left expression.

public boolean

Returns:

true if there is a right StateObject; false if it is null
hasRight
()

Determines whether there is a StateObject that represents the right expression.

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
parseLeft(String
The portion of the query to become the left side of the compound expression
jpqlFragment
)

Parses the given JPQL fragment and update the left side of the compound expression.

public void
parseRight(String
The portion of the query to become the right side of the compound expression
jpqlFragment
)

Parses the given JPQL fragment and update the right side of the compound expression.

public void
setLeft(StateObject
The StateObject representing the left expression
leftStateObject
)

Sets the left StateObject to become the given object.

public void
setRight(StateObject
The StateObject representing the right expression
rightStateObject
)

Sets the right StateObject to become the given object.

protected void
toTextInternal(Appendable
The writer used to print out the string representation
writer
)

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.toTextInternal.

Prints out a string representation of this StateObject, 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.AbstractStateObject:
acceptUnknownVisitoracceptUnknownVisitoraddProblemsaddPropertyChangeListenerareEquivalentbuildProblembuildProblembuildStateObjectbuildStateObjectscheckParentchildrendecorateequalsfindIdentificationVariablefirePropertyChangedgetChangeSupportgetDeclarationgetDecoratorgetGrammargetManagedTypeProvidergetParentgetQueryBuildergetRootgetTypegetTypegetTypeHelpergetTypeRepositoryhashCodeinitializeisDecoratedparentparentparentremovePropertyChangeListenersetExpressionsetParenttoStringtoStringtoStringInternaltoStringItemstoText

Field Detail

LEFT_STATE_OBJECT_PROPERTYback to summary
public static final String LEFT_STATE_OBJECT_PROPERTY

Notifies the left state object property has changed.

leftStateObjectback to summary
private StateObject leftStateObject

The StateObject representing the left expression.

RIGHT_STATE_OBJECT_PROPERTYback to summary
public static final String RIGHT_STATE_OBJECT_PROPERTY

Notifies the right state object property has changed.

rightStateObjectback to summary
private StateObject rightStateObject

The StateObject representing the right expression.

Constructor Detail

CompoundExpressionStateObjectback to summary
protected CompoundExpressionStateObject(StateObject parent)

Creates a new CompoundExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null
CompoundExpressionStateObjectback to summary
protected CompoundExpressionStateObject(StateObject parent, StateObject leftStateObject, StateObject rightStateObject)

Creates a new ArithmeticExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

leftStateObject:StateObject

The StateObject representing the left expression

rightStateObject:StateObject

The StateObject representing the right expression

Exceptions
NullPointerException:
The given parent cannot be null
CompoundExpressionStateObjectback to summary
protected CompoundExpressionStateObject(StateObject parent, String leftJpqlFragment, String rightJpqlFragment)

Creates a new ArithmeticExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

leftJpqlFragment:String

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

rightJpqlFragment:String

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

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 CompoundExpression getExpression()

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

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
getIdentifierback to summary
public abstract String getIdentifier()

Returns the identifier joining the two StateObjects.

Returns:String

The JPQL identifier join two expressions

getLeftback to summary
public StateObject getLeft()

Returns the StateObject that represents the left expression.

Returns:StateObject

The StateObject representing the left expression

getLeftQueryBNFIdback to summary
protected abstract String getLeftQueryBNFId()

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

Returns:String

The query BNF ID for the left side of the expression

getRightback to summary
public StateObject getRight()

Returns the StateObject that represents the right expression.

Returns:StateObject

The StateObject representing the right expression

getRightQueryBNFIdback to summary
protected abstract String getRightQueryBNFId()

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

Returns:String

The query BNF ID for the right side of the expression

hasLeftback to summary
public boolean hasLeft()

Determines whether there is a StateObject that represents the left expression.

Returns:boolean

true if there is a left StateObject; false if it is null

hasRightback to summary
public boolean hasRight()

Determines whether there is a StateObject that represents the right expression.

Returns:boolean

true if there is a right StateObject; false if it is null

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
parseLeftback to summary
public void parseLeft(String jpqlFragment)

Parses the given JPQL fragment and update the left side of the compound expression.

Parameters
jpqlFragment:String

The portion of the query to become the left side of the compound expression

parseRightback to summary
public void parseRight(String jpqlFragment)

Parses the given JPQL fragment and update the right side of the compound expression.

Parameters
jpqlFragment:String

The portion of the query to become the right side of the compound expression

setLeftback to summary
public void setLeft(StateObject leftStateObject)

Sets the left StateObject to become the given object.

Parameters
leftStateObject:StateObject

The StateObject representing the left expression

setRightback to summary
public void setRight(StateObject rightStateObject)

Sets the right StateObject to become the given object.

Parameters
rightStateObject:StateObject

The StateObject representing the right expression

toTextInternalback to summary
protected void toTextInternal(Appendable writer) throws IOException

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.toTextInternal.

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

Prints out a string representation of this StateObject, 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

Annotations
@Override
Exceptions
IOException:
This should never happens, it is only required because Appendable is used instead of any concrete class