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

public Class BetweenExpressionStateObject

extends AbstractStateObject
Class Inheritance
Annotations
@SuppressWarnings:nls, unused
Imports
java.io.IOException, java.util.List, org.eclipse.persistence.jpa.jpql.parser.BetweenExpression, .InternalBetweenExpressionBNF

Used in conditional expression to determine whether the result of an expression falls within an inclusive range of values. Numeric, string and date expression can be evaluated in this way.
BNF: between_expression ::= arithmetic_expression [NOT] BETWEEN arithmetic_expression AND arithmetic_expression |
string_expression [NOT] BETWEEN string_expression AND string_expression |
datetime_expression [NOT] BETWEEN datetime_expression AND datetime_expression
Author
Pascal Filion
Since
2.4
Version
2.4
See Also
BetweenExpression

Field Summary

Modifier and TypeField and Description
public static final String
LOWER_STATE_OBJECT_PROPERTY

Notifies the StateObject representing the lower bound expression has changed.

private StateObject
lowerBoundStateObject

The StateObject representing the lower bound expression.

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.

public static final String
STATE_OBJECT_PROPERTY

Notifies the state object property has changed.

private StateObject
stateObject

The StateObject representing the expression to determine if its result falls within the lower and upper bounds.

public static final String
UPPER_STATE_OBJECT_PROPERTY

Notifies the StateObject representing the upper bound expression has changed.

private StateObject
upperBoundStateObject

The StateObject representing the upper bound expression.

Constructor Summary

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

Creates a new BetweenExpressionStateObject.

public
BetweenExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
StateObject
The StateObject representing the expression to compare its result to the lower and upper bounds
stateObject
,
boolean
Determines whether the NOT identifier is part of the expression or not
not
,
StateObject
The StateObject representing the lower bound expression
lowerBound
,
StateObject
The StateObject representing the upper bound expression
upperBound
)

Creates a new BetweenExpressionStateObject.

public
BetweenExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
StateObject
The StateObject representing the expression to compare its result to the lower and upper bounds
stateObject
,
StateObject
The StateObject representing the lower bound expression
lowerBound
,
StateObject
The StateObject representing the upper bound expression
upperBound
)

Creates a new BetweenExpressionStateObject.

public
BetweenExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
String
The JPQL fragment representing the expression to compare its result to the lower and upper bounds, the fragment will be parsed and converted into a StateObject
jpqlFragment
,
boolean
Determines whether the NOT identifier is part of the expression or not
not
,
String
The JPQL fragment representing the lower bound of the range, the fragment will be parsed and converted into a StateObject
lowerBoundJpqlFragment
,
String
The JPQL fragment representing the upper bound of the range, the fragment will be parsed and converted into a StateObject
upperBoundJpqlFragment
)

Creates a new BetweenExpressionStateObject.

public
BetweenExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
String
The JPQL fragment representing the expression to compare its result to the lower and upper bounds, the fragment will be parsed and converted into a StateObject
jpqlFragment
,
String
The JPQL fragment representing the lowe bound of the range, the fragment will be parsed and converted into a StateObject
lowerBoundJpqlFragment
,
String
The JPQL fragment representing the upper bound of the range, the fragment will be parsed and converted into a StateObject
upperBoundJpqlFragment
)

Creates a new BetweenExpressionStateObject.

Method Summary

Modifier and TypeMethod and Description
public void
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 BetweenExpressionStateObject

Returns:

This object
addNot
()

Makes sure the NOT identifier is specified.

public BetweenExpression
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 StateObject

Returns:

The expression representing the lower bound
getLowerBound
()

Returns the StateObject representing the lower bound of the range.

public StateObject

Returns:

The expression to check if its result is in the range of the lower and upper bounds
getStateObject
()

Returns the StateObject representing the expression to determine if its result falls within the lower and upper bounds.

public StateObject

Returns:

The expression representing the upper bound
getUpperBound
()

Returns the StateObject representing the upper bound of the range.

public boolean

Returns:

true if the StateObject representing the expression to check if its result falls into a range has been defined; false otherwise
hasLowerBound
()

Determines whether the StateObject representing the lower bound is defined or not.

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

Returns:

true if the StateObject representing the lower bound expression has been defined; false otherwise
hasStateObject
()

Determines whether the StateObject representing the expression to determine if its result falls within the lower and upper bounds has been defined or not.

public boolean

Returns:

true if the StateObject representing the upper bound expression has been defined; false otherwise
hasUpperBound
()

Determines whether the StateObject representing the upper bound is defined 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 JPQL fragment representing the expression to compare its result to the lower and upper bounds, the fragment will be parsed and converted into a StateObject
jpqlFragment
)

Parses the given JPQL fragment, which will represent the expression to compare its result to the lower and upper bounds.

public void
parseLowerBound(String
The JPQL fragment representing the lower bound of the range, the fragment will be parsed and converted into a StateObject
jpqlFragment
)

Parses the given JPQL fragment, which will represent the lower bound of the range.

public void
parseUpperBound(String
The JPQL fragment representing the upper bound of the range, the fragment will be parsed and converted into a StateObject
jpqlFragment
)

Parses the given JPQL fragment, which will represent the upper bound of the range.

public void
removeNot()

Makes sure the NOT identifier is not specified.

public void
setExpression(BetweenExpression
The parsed object representing a BETWEEN 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
setLowerBound(StateObject
The StateObject representing the lower bound expression
lowerBound
)

Sets the StateObject representing the lower bound of the range.

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 expression to check if its result is in the range of the lower and upper bounds
stateObject
)

Sets the StateObject representing the expression to determine if its result falls within the lower and upper bounds.

public void
setUpperBound(StateObject
The StateObject representing the upper bound expression
upperBound
)

Sets the StateObject representing the upper bound of the range.

public void
toggleNot()

Changes the visibility state of the NOT identifier.

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

LOWER_STATE_OBJECT_PROPERTYback to summary
public static final String LOWER_STATE_OBJECT_PROPERTY

Notifies the StateObject representing the lower bound expression has changed.

lowerBoundStateObjectback to summary
private StateObject lowerBoundStateObject

The StateObject representing the lower bound expression.

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.

STATE_OBJECT_PROPERTYback to summary
public static final String STATE_OBJECT_PROPERTY

Notifies the state object property has changed.

stateObjectback to summary
private StateObject stateObject

The StateObject representing the expression to determine if its result falls within the lower and upper bounds.

UPPER_STATE_OBJECT_PROPERTYback to summary
public static final String UPPER_STATE_OBJECT_PROPERTY

Notifies the StateObject representing the upper bound expression has changed.

upperBoundStateObjectback to summary
private StateObject upperBoundStateObject

The StateObject representing the upper bound expression.

Constructor Detail

BetweenExpressionStateObjectback to summary
public BetweenExpressionStateObject(StateObject parent)

Creates a new BetweenExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null
BetweenExpressionStateObjectback to summary
public BetweenExpressionStateObject(StateObject parent, StateObject stateObject, boolean not, StateObject lowerBound, StateObject upperBound)

Creates a new BetweenExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

stateObject:StateObject

The StateObject representing the expression to compare its result to the lower and upper bounds

not:boolean

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

lowerBound:StateObject

The StateObject representing the lower bound expression

upperBound:StateObject

The StateObject representing the upper bound expression

Exceptions
NullPointerException:
The given parent cannot be null
BetweenExpressionStateObjectback to summary
public BetweenExpressionStateObject(StateObject parent, StateObject stateObject, StateObject lowerBound, StateObject upperBound)

Creates a new BetweenExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

stateObject:StateObject

The StateObject representing the expression to compare its result to the lower and upper bounds

lowerBound:StateObject

The StateObject representing the lower bound expression

upperBound:StateObject

The StateObject representing the upper bound expression

Exceptions
NullPointerException:
The given parent cannot be null
BetweenExpressionStateObjectback to summary
public BetweenExpressionStateObject(StateObject parent, String jpqlFragment, boolean not, String lowerBoundJpqlFragment, String upperBoundJpqlFragment)

Creates a new BetweenExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

jpqlFragment:String

The JPQL fragment representing the expression to compare its result to the lower and upper bounds, the fragment will be parsed and converted into a StateObject

not:boolean

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

lowerBoundJpqlFragment:String

The JPQL fragment representing the lower bound of the range, the fragment will be parsed and converted into a StateObject

upperBoundJpqlFragment:String

The JPQL fragment representing the upper bound of the range, the fragment will be parsed and converted into a StateObject

Exceptions
NullPointerException:
The given parent cannot be null
BetweenExpressionStateObjectback to summary
public BetweenExpressionStateObject(StateObject parent, String jpqlFragment, String lowerBoundJpqlFragment, String upperBoundJpqlFragment)

Creates a new BetweenExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

jpqlFragment:String

The JPQL fragment representing the expression to compare its result to the lower and upper bounds, the fragment will be parsed and converted into a StateObject

lowerBoundJpqlFragment:String

The JPQL fragment representing the lowe bound of the range, the fragment will be parsed and converted into a StateObject

upperBoundJpqlFragment:String

The JPQL fragment representing the upper bound of the range, the fragment will be parsed and converted into a StateObject

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

Makes sure the NOT identifier is specified.

Returns:BetweenExpressionStateObject

This object

getExpressionback to summary
public BetweenExpression 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:BetweenExpression

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
getLowerBoundback to summary
public StateObject getLowerBound()

Returns the StateObject representing the lower bound of the range.

Returns:StateObject

The expression representing the lower bound

getStateObjectback to summary
public StateObject getStateObject()

Returns the StateObject representing the expression to determine if its result falls within the lower and upper bounds.

Returns:StateObject

The expression to check if its result is in the range of the lower and upper bounds

getUpperBoundback to summary
public StateObject getUpperBound()

Returns the StateObject representing the upper bound of the range.

Returns:StateObject

The expression representing the upper bound

hasLowerBoundback to summary
public boolean hasLowerBound()

Determines whether the StateObject representing the lower bound is defined or not.

Returns:boolean

true if the StateObject representing the expression to check if its result falls into a range has been defined; false otherwise

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

hasStateObjectback to summary
public boolean hasStateObject()

Determines whether the StateObject representing the expression to determine if its result falls within the lower and upper bounds has been defined or not.

Returns:boolean

true if the StateObject representing the lower bound expression has been defined; false otherwise

hasUpperBoundback to summary
public boolean hasUpperBound()

Determines whether the StateObject representing the upper bound is defined or not.

Returns:boolean

true if the StateObject representing the upper bound expression has been defined; 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 will represent the expression to compare its result to the lower and upper bounds.

Parameters
jpqlFragment:String

The JPQL fragment representing the expression to compare its result to the lower and upper bounds, the fragment will be parsed and converted into a StateObject

parseLowerBoundback to summary
public void parseLowerBound(String jpqlFragment)

Parses the given JPQL fragment, which will represent the lower bound of the range.

Parameters
jpqlFragment:String

The JPQL fragment representing the lower bound of the range, the fragment will be parsed and converted into a StateObject

parseUpperBoundback to summary
public void parseUpperBound(String jpqlFragment)

Parses the given JPQL fragment, which will represent the upper bound of the range.

Parameters
jpqlFragment:String

The JPQL fragment representing the upper bound of the range, the fragment will be parsed and converted into a StateObject

removeNotback to summary
public void removeNot()

Makes sure the NOT identifier is not specified.

setExpressionback to summary
public void setExpression(BetweenExpression 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:BetweenExpression

The parsed object representing a BETWEEN expression

setLowerBoundback to summary
public void setLowerBound(StateObject lowerBound)

Sets the StateObject representing the lower bound of the range.

Parameters
lowerBound:StateObject

The StateObject representing the lower bound 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)

Sets the StateObject representing the expression to determine if its result falls within the lower and upper bounds.

Parameters
stateObject:StateObject

The expression to check if its result is in the range of the lower and upper bounds

setUpperBoundback to summary
public void setUpperBound(StateObject upperBound)

Sets the StateObject representing the upper bound of the range.

Parameters
upperBound:StateObject

The StateObject representing the upper bound expression

toggleNotback to summary
public void toggleNot()

Changes the visibility state of the NOT identifier.

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