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

public Class ExistsExpressionStateObject

extends AbstractSingleEncapsulatedExpressionStateObject
Class Inheritance
Annotations
@SuppressWarnings:nls, unused
Imports
java.io.IOException, org.eclipse.persistence.jpa.jpql.parser.ExistsExpression, .SubqueryBNF

An 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.

BNF: exists_expression ::= [NOT] EXISTS(subquery)

Author
Pascal Filion
Since
2.4
Version
2.4
See Also
ExistsExpression

Field Summary

Modifier and TypeField and Description
private boolean
not

Determines whether the NOT identifier is part of the expression or not.

public static final String
NOT_PROPERTY

Notifies the visibility of the NOT identifier has changed.

Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject:
STATE_OBJECT_PROPERTY

Constructor Summary

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

Creates a new ExistsExpressionStateObject.

public
ExistsExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
boolean
Determines whether the NOT identifier is part of the expression or not
not
,
StateObject
The StateObject representing the subquery
stateObject
)

Creates a new ExistsExpressionStateObject.

public
ExistsExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
boolean
Determines whether the NOT identifier is part of the expression or not
not
,
String
The portion of the query representing the encapsulated expression
jpqlFragment
)

Creates a new ExistsExpressionStateObject.

public
ExistsExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
StateObject
The StateObject representing the subquery
stateObject
)

Creates a new ExistsExpressionStateObject.

public
ExistsExpressionStateObject(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 ExistsExpressionStateObject.

Method Summary

Modifier and TypeMethod and Description
public void
public ExistsExpressionStateObject

Returns:

This object
addNot
()

Makes sure the NOT identifier is specified.

public ExistsExpression
getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject.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 String
protected String
getQueryBNFId()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject.getQueryBNFId.

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

Returns:

true if the NOT identifier is part of the expression; false otherwise
hasNot
()

Determines whether the NOT identifier is used 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.AbstractSingleEncapsulatedExpressionStateObject.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
removeNot()

Makes sure the NOT identifier is not specified.

public void
setExpression(ExistsExpression
The parsed object representing an EXISTS 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.

public void
setNot(boolean
true if the NOT identifier should be part of the expression; false otherwise
not
)

Sets whether the NOT identifier should be part of the expression or not.

public void
setStateObject(StateObject
The new encapsulated StateObject
stateObject
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject.setStateObject.

Sets the given StateObject to represent the new encapsulated expression.
public void
toggleNot()

Changes the visibility state of the NOT identifier.

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

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

Field Detail

notback to summary
private boolean not

Determines whether the NOT identifier is part of the expression or not.

NOT_PROPERTYback to summary
public static final String NOT_PROPERTY

Notifies the visibility of the NOT identifier has changed.

Constructor Detail

ExistsExpressionStateObjectback to summary
public ExistsExpressionStateObject(StateObject parent)

Creates a new ExistsExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null
ExistsExpressionStateObjectback to summary
public ExistsExpressionStateObject(StateObject parent, boolean not, StateObject stateObject)

Creates a new ExistsExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

not:boolean

Determines whether the NOT identifier is part of the expression or not

stateObject:StateObject

The StateObject representing the subquery

Exceptions
NullPointerException:
The given parent cannot be null
ExistsExpressionStateObjectback to summary
public ExistsExpressionStateObject(StateObject parent, boolean not, String jpqlFragment)

Creates a new ExistsExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

not:boolean

Determines whether the NOT identifier is part of the expression or not

jpqlFragment:String

The portion of the query representing the encapsulated expression

Exceptions
NullPointerException:
The given parent cannot be null
ExistsExpressionStateObjectback to summary
public ExistsExpressionStateObject(StateObject parent, StateObject stateObject)

Creates a new ExistsExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

stateObject:StateObject

The StateObject representing the subquery

Exceptions
NullPointerException:
The given parent cannot be null
ExistsExpressionStateObjectback to summary
public ExistsExpressionStateObject(StateObject parent, String jpqlFragment)

Creates a new ExistsExpressionStateObject.

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

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
addNotback to summary
public ExistsExpressionStateObject addNot()

Makes sure the NOT identifier is specified.

Returns:ExistsExpressionStateObject

This object

getExpressionback to summary
public ExistsExpression getExpression()

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

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

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject.getQueryBNFId.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject.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

Annotations
@Override
hasNotback to summary
public boolean hasNot()

Determines whether the NOT identifier is used or not.

Returns:boolean

true if the NOT identifier is part of the expression; false otherwise

isEquivalentback to summary
public boolean isEquivalent(StateObject stateObject)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject.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
removeNotback to summary
public void removeNot()

Makes sure the NOT identifier is not specified.

setExpressionback to summary
public 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.

Parameters
expression:ExistsExpression

The parsed object representing an EXISTS expression

setNotback to summary
public void setNot(boolean not)

Sets whether the NOT identifier should be part of the expression or not.

Parameters
not:boolean

true if the NOT identifier should be part of the expression; false otherwise

setStateObjectback to summary
public void setStateObject(StateObject stateObject)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject.setStateObject.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject.setStateObject.

Sets the given StateObject to represent the new encapsulated expression.

Parameters
stateObject:StateObject

The new encapsulated StateObject

Annotations
@Override
toggleNotback to summary
public void toggleNot()

Changes the visibility state of the NOT identifier.

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

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