public abstract class CompoundExpressionStateObject extends AbstractStateObject
StateObject
has a left and right expressions combined by an identifier.
expression ::= left_expression <identifier> right_expression
CompoundExpression
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LEFT_STATE_OBJECT_PROPERTY
Notifies the left state object property has changed.
|
static java.lang.String |
RIGHT_STATE_OBJECT_PROPERTY
Notifies the right state object property has changed.
|
Modifier | Constructor and Description |
---|---|
protected |
CompoundExpressionStateObject(StateObject parent)
Creates a new
CompoundExpressionStateObject . |
protected |
CompoundExpressionStateObject(StateObject parent,
StateObject leftStateObject,
StateObject rightStateObject)
Creates a new
ArithmeticExpressionStateObject . |
protected |
CompoundExpressionStateObject(StateObject parent,
java.lang.String leftJpqlFragment,
java.lang.String rightJpqlFragment)
Creates a new
ArithmeticExpressionStateObject . |
Modifier and Type | Method and Description |
---|---|
protected void |
addChildren(java.util.List<StateObject> children)
Adds the children of this
StateObject to the given list. |
CompoundExpression |
getExpression()
Returns the actual parsed object if this
StateObject representation of the JPQL query
was created by parsing an existing JPQL query. |
abstract java.lang.String |
getIdentifier()
Returns the identifier joining the two
StateObjects . |
StateObject |
getLeft()
Returns the
StateObject that represents the left expression. |
protected abstract java.lang.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.
|
StateObject |
getRight()
Returns the
StateObject that represents the right expression. |
protected abstract java.lang.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.
|
boolean |
hasLeft()
Determines whether there is a
StateObject that represents the left expression. |
boolean |
hasRight()
Determines whether there is a
StateObject that represents the right expression. |
boolean |
isEquivalent(StateObject stateObject)
Determines whether the given
StateObject is equivalent to this one, i.e. the
information of both StateObject is the same. |
void |
parseLeft(java.lang.String jpqlFragment)
Parses the given JPQL fragment and update the left side of the compound expression.
|
void |
parseRight(java.lang.String jpqlFragment)
Parses the given JPQL fragment and update the right side of the compound expression.
|
void |
setLeft(StateObject leftStateObject)
Sets the left
StateObject to become the given object. |
void |
setRight(StateObject rightStateObject)
Sets the right
StateObject to become the given object. |
protected void |
toTextInternal(java.lang.Appendable writer)
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. |
acceptUnknownVisitor, acceptUnknownVisitor, addProblems, addPropertyChangeListener, areEquivalent, buildProblem, buildProblem, buildStateObject, buildStateObjects, checkParent, children, decorate, equals, findIdentificationVariable, firePropertyChanged, getChangeSupport, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getParent, getQueryBuilder, getRoot, getType, getType, getTypeHelper, getTypeRepository, hashCode, initialize, isDecorated, parent, parent, parent, removePropertyChangeListener, setExpression, setParent, toString, toString, toStringInternal, toStringItems, toText
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
accept
public static final java.lang.String LEFT_STATE_OBJECT_PROPERTY
public static final java.lang.String RIGHT_STATE_OBJECT_PROPERTY
protected CompoundExpressionStateObject(StateObject parent)
CompoundExpressionStateObject
.parent
- The parent of this state object, which cannot be null
java.lang.NullPointerException
- The given parent cannot be null
protected CompoundExpressionStateObject(StateObject parent, StateObject leftStateObject, StateObject rightStateObject)
ArithmeticExpressionStateObject
.parent
- The parent of this state object, which cannot be null
leftStateObject
- The StateObject
representing the left expressionrightStateObject
- The StateObject
representing the right expressionjava.lang.NullPointerException
- The given parent cannot be null
protected CompoundExpressionStateObject(StateObject parent, java.lang.String leftJpqlFragment, java.lang.String rightJpqlFragment)
ArithmeticExpressionStateObject
.parent
- The parent of this state object, which cannot be null
leftJpqlFragment
- The string representation of the left expression to parse and to
convert into a StateObject
rightJpqlFragment
- The string representation of the right expression to parse and to
convert into a StateObject
java.lang.NullPointerException
- The given parent cannot be null
protected void addChildren(java.util.List<StateObject> children)
StateObject
to the given list.addChildren
in class AbstractStateObject
children
- The list used to store the childrenpublic CompoundExpression getExpression()
StateObject
representation of the JPQL query
was created by parsing an existing JPQL query.getExpression
in interface StateObject
getExpression
in class AbstractStateObject
StateObject
or null
when the JPQL query is manually created (i.e. not from a string)public abstract java.lang.String getIdentifier()
StateObjects
.public StateObject getLeft()
StateObject
that represents the left expression.StateObject
representing the left expressionprotected abstract java.lang.String getLeftQueryBNFId()
public StateObject getRight()
StateObject
that represents the right expression.StateObject
representing the right expressionprotected abstract java.lang.String getRightQueryBNFId()
public boolean hasLeft()
StateObject
that represents the left expression.true
if there is a left StateObject
; false
if it is
null
public boolean hasRight()
StateObject
that represents the right expression.true
if there is a right StateObject
; false
if it
is null
public boolean isEquivalent(StateObject stateObject)
StateObject
is equivalent to this one, i.e. the
information of both StateObject
is the same.isEquivalent
in interface StateObject
isEquivalent
in class AbstractStateObject
stateObject
- The StateObject
to compare its content to this onetrue
if both object are equivalent; false
otherwisepublic void parseLeft(java.lang.String jpqlFragment)
jpqlFragment
- The portion of the query to become the left side of the compound expressionpublic void parseRight(java.lang.String jpqlFragment)
jpqlFragment
- The portion of the query to become the right side of the compound expressionpublic void setLeft(StateObject leftStateObject)
StateObject
to become the given object.leftStateObject
- The StateObject
representing the left expressionpublic void setRight(StateObject rightStateObject)
StateObject
to become the given object.rightStateObject
- The StateObject
representing the right expressionprotected void toTextInternal(java.lang.Appendable writer) throws java.io.IOException
StateObject
, which should not be used to
define a true
string representation of a JPQL query but should be used for
debugging purposes.toTextInternal
in class AbstractStateObject
writer
- The writer used to print out the string representationjava.io.IOException
- This should never happens, it is only required because Appendable
is used instead of any concrete class