public class ExistsExpressionStateObject extends AbstractSingleEncapsulatedExpressionStateObject
EXISTS
expression is a predicate that is true
only if the
result of the subquery consists of one or more values and that is false
otherwise.
exists_expression ::= [NOT] EXISTS(subquery)
ExistsExpression
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NOT_PROPERTY
Notifies the visibility of the
NOT identifier has changed. |
STATE_OBJECT_PROPERTY
Constructor and Description |
---|
ExistsExpressionStateObject(StateObject parent)
Creates a new
ExistsExpressionStateObject . |
ExistsExpressionStateObject(StateObject parent,
boolean not,
StateObject stateObject)
Creates a new
ExistsExpressionStateObject . |
ExistsExpressionStateObject(StateObject parent,
boolean not,
java.lang.String jpqlFragment)
Creates a new
ExistsExpressionStateObject . |
ExistsExpressionStateObject(StateObject parent,
StateObject stateObject)
Creates a new
ExistsExpressionStateObject . |
ExistsExpressionStateObject(StateObject parent,
java.lang.String jpqlFragment)
Creates a new
ExistsExpressionStateObject . |
Modifier and Type | Method and Description |
---|---|
void |
accept(StateObjectVisitor visitor)
Visits this
StateObject by the given visitor . |
ExistsExpressionStateObject |
addNot()
Makes sure the
NOT identifier is specified. |
ExistsExpression |
getExpression()
Returns the actual parsed object if this
StateObject representation of the JPQL query
was created by parsing an existing JPQL query. |
java.lang.String |
getIdentifier()
Returns the JPQL identifier of the expression represented by this
AbstractSingleEncapsulatedExpressionStateObject . |
protected java.lang.String |
getQueryBNFId()
Returns the unique identifier of the
JPQLQueryBNF that will determine how to parse the encapsulated expression. |
boolean |
hasNot()
Determines whether the
NOT identifier is used or not. |
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 |
removeNot()
Makes sure the
NOT identifier is not specified. |
void |
setExpression(ExistsExpression 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 . |
void |
setNot(boolean not)
Sets whether the
NOT identifier should be part of the expression or not. |
void |
setStateObject(StateObject stateObject)
Sets the given
StateObject to represent the new encapsulated expression. |
void |
toggleNot()
Changes the visibility state of the
NOT identifier. |
protected void |
toTextEncapsulatedExpression(java.lang.Appendable writer)
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. |
addChildren, getStateObject, hasStateObject, parse
toTextInternal
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
public static java.lang.String NOT_PROPERTY
NOT
identifier has changed.public ExistsExpressionStateObject(StateObject parent)
ExistsExpressionStateObject
.parent
- The parent of this state object, which cannot be null
java.lang.NullPointerException
- The given parent cannot be null
public ExistsExpressionStateObject(StateObject parent, boolean not, StateObject stateObject)
ExistsExpressionStateObject
.parent
- The parent of this state object, which cannot be null
not
- Determines whether the NOT
identifier is part of the expression
or notstateObject
- The StateObject
representing the subqueryjava.lang.NullPointerException
- The given parent cannot be null
public ExistsExpressionStateObject(StateObject parent, boolean not, java.lang.String jpqlFragment)
ExistsExpressionStateObject
.parent
- The parent of this state object, which cannot be null
not
- Determines whether the NOT
identifier is part of the expression
or notjpqlFragment
- The portion of the query representing the encapsulated expressionjava.lang.NullPointerException
- The given parent cannot be null
public ExistsExpressionStateObject(StateObject parent, StateObject stateObject)
ExistsExpressionStateObject
.parent
- The parent of this state object, which cannot be null
stateObject
- The StateObject
representing the subqueryjava.lang.NullPointerException
- The given parent cannot be null
public ExistsExpressionStateObject(StateObject parent, java.lang.String jpqlFragment)
ExistsExpressionStateObject
.parent
- The parent of this state object, which cannot be null
jpqlFragment
- The portion of the query representing the encapsulated expressionjava.lang.NullPointerException
- The given parent cannot be null
public void accept(StateObjectVisitor visitor)
StateObject
by the given visitor
.visitor
- The visitor
to visit this objectpublic ExistsExpressionStateObject addNot()
NOT
identifier is specified.public ExistsExpression getExpression()
StateObject
representation of the JPQL query
was created by parsing an existing JPQL query.getExpression
in interface StateObject
getExpression
in class AbstractSingleEncapsulatedExpressionStateObject
StateObject
or null
when the JPQL query is manually created (i.e. not from a string)public java.lang.String getIdentifier()
AbstractSingleEncapsulatedExpressionStateObject
.getIdentifier
in class AbstractEncapsulatedExpressionStateObject
protected java.lang.String getQueryBNFId()
JPQLQueryBNF
that will determine how to parse the encapsulated expression.getQueryBNFId
in class AbstractSingleEncapsulatedExpressionStateObject
null
ID of the BNFpublic boolean hasNot()
NOT
identifier is used or not.true
if the NOT
identifier is part of the expression;
false
otherwisepublic 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 AbstractSingleEncapsulatedExpressionStateObject
stateObject
- The StateObject
to compare its content to this onetrue
if both object are equivalent; false
otherwisepublic void removeNot()
NOT
identifier is not specified.public void setExpression(ExistsExpression expression)
parsed object
object, which should only be
done when this object is instantiated during the conversion of a parsed JPQL query into
StateObjects
.expression
- The parsed object
representing an EXISTS
expressionpublic void setNot(boolean not)
NOT
identifier should be part of the expression or not.not
- true
if the NOT
identifier should be part of the
expression; false
otherwisepublic void setStateObject(StateObject stateObject)
StateObject
to represent the new encapsulated expression.setStateObject
in class AbstractSingleEncapsulatedExpressionStateObject
stateObject
- The new encapsulated StateObject
public void toggleNot()
NOT
identifier.protected void toTextEncapsulatedExpression(java.lang.Appendable writer) throws java.io.IOException
true
string representation of a JPQL query but should be used for
debugging purposes.toTextEncapsulatedExpression
in class AbstractSingleEncapsulatedExpressionStateObject
writer
- The writer used to print out the string representation of the encapsulated
informationjava.io.IOException
- This should never happens, only required because Appendable
is
used instead of StringBuilder
for instance