Class InExpressionStateObject
java.lang.Object
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject<StateObject>
org.eclipse.persistence.jpa.jpql.tools.model.query.InExpressionStateObject
- All Implemented Interfaces:
ListHolderStateObject<StateObject>,StateObject
The state field path expression must have a string, numeric, or enum value. The literal and/or
input parameter values must be like the same abstract schema type of the state field path
expression in type.
JPA 2.0
The results of the subquery must be like the same abstract schema type of the state field path expression in type.
There must be at least one element in the comma separated list that defines the set of values for
the IN expression. If the value of a state field path expression in an
IN or NOT IN expression is NULL or
unknown, the value of the expression is unknown.
JPA 1.0:
BNF: in_expression ::= state_field_path_expression [NOT] IN(in_item {, in_item}* | subquery)
BNF: in_expression ::= {state_field_path_expression | type_discriminator} [NOT] IN { ( in_item {, in_item}* ) | (subquery) | collection_valued_input_parameter }
- Since:
- 2.4
- Version:
- 2.4
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringNotifies the list of items has changed.static final StringNotifies the visibility of theNOTidentifier has changed.static final StringNotifies theStateObjectrepresenting the state field path expression or the input parameter has changed. -
Constructor Summary
ConstructorsConstructorDescriptionInExpressionStateObject(StateObject parent) Creates a newInExpressionStateObject.InExpressionStateObject(StateObject parent, boolean not, String path, String parameter) Creates a newInExpressionStateObject.InExpressionStateObject(StateObject parent, boolean not, String path, List<String> items) Creates a newInExpressionStateObject.InExpressionStateObject(StateObject parent, String path, List<String> items) Creates a newInExpressionStateObject.InExpressionStateObject(StateObject parent, StateObject stateObject, boolean not, List<? extends StateObject> items) Creates a newInExpressionStateObject.InExpressionStateObject(StateObject parent, StateObject stateFieldPath, List<? extends StateObject> items) Creates a newInExpressionStateObject. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(StateObjectVisitor visitor) Visits thisStateObjectby the givenvisitor.protected voidaddChildren(List<StateObject> children) Adds the children of thisStateObjectto the given list.addNot()Makes sure theNOTidentifier is specified.Returns the actual parsed object if thisStateObjectrepresentation of the JPQL query was created by parsing an existing JPQL query.ReturnsbooleanhasNot()Determines whether theNOTidentifier is used or not.booleanDetermines whetherbooleanisEquivalent(StateObject stateObject) Determines whether the givenStateObjectis equivalent to this one, i.e.booleanDetermines whether what was parsed after theINidentifier is a single input parameter.protected StringlistName()Returns the name that is uniquely identifying the list.voidParses the given JPQL fragment, which represents either a single or many items, the fragment will be parsed and converted intoStateObject.voidMakes sure theNOTidentifier is not specified.voidsetExpression(InExpression expression) Keeps a reference of theparsed objectobject, which should only be done when this object is instantiated during the conversion of a parsed JPQL query intoStateObjects.voidsetNot(boolean not) Sets whether theNOTidentifier should be part of the expression or not.voidsetSingleInputParameter(boolean singleInputParameter) Sets whether what was parsed after theINidentifier is a single input parameter.voidsetStateObject(StateObject stateObject) SetsvoidChanges the visibility state of theNOTidentifier.protected voidtoTextInternal(Appendable writer) Prints out a string representation of thisStateObject, which should not be used to define atruestring representation of a JPQL query but should be used for debugging purposes.Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject
addItem, addItems, addListChangeListener, areChildrenEquivalent, canMoveDown, canMoveUp, getItem, hasItems, initialize, items, itemsSize, moveDown, moveUp, removeItem, removeItems, removeListChangeListener, toStringItemsMethods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
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, isDecorated, parent, parent, parent, removePropertyChangeListener, setExpression, setParent, toString, toString, toStringInternal, toStringItems, toTextMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject
addPropertyChangeListener, children, decorate, findIdentificationVariable, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getParent, getQueryBuilder, getRoot, isDecorated, removePropertyChangeListener, setParent, toString, toText
-
Field Details
-
ITEMS_LIST
Notifies the list of items has changed.- See Also:
-
NOT_PROPERTY
Notifies the visibility of theNOTidentifier has changed.- See Also:
-
STATE_OBJECT_PROPERTY
Notifies theStateObjectrepresenting the state field path expression or the input parameter has changed.- See Also:
-
-
Constructor Details
-
InExpressionStateObject
Creates a newInExpressionStateObject.- Parameters:
parent- The parent of this state object, which cannot benull- Throws:
NullPointerException- The given parent cannot benull
-
InExpressionStateObject
Creates a newInExpressionStateObject.- Parameters:
parent- The parent of this state object, which cannot benullnot- Determines whether theNOTidentifier is part of the expression or notitems- The list of JPQL fragments that will be parsed and converted intoStateObject- Throws:
NullPointerException- The given parent cannot benull
-
InExpressionStateObject
Creates a newInExpressionStateObject.- Parameters:
parent- The parent of this state object, which cannot benullnot- Determines whether theNOTidentifier is part of the expression or notparameter- The- Throws:
NullPointerException- The given parent cannot benull
-
InExpressionStateObject
public InExpressionStateObject(StateObject parent, StateObject stateObject, boolean not, List<? extends StateObject> items) Creates a newInExpressionStateObject.- Parameters:
parent- The parent of this state object, which cannot benullnot- Determines whether theNOTidentifier is part of the expression or not- Throws:
NullPointerException- The given parent cannot benull
-
InExpressionStateObject
public InExpressionStateObject(StateObject parent, StateObject stateFieldPath, List<? extends StateObject> items) Creates a newInExpressionStateObject.- Parameters:
parent- The parent of this state object, which cannot benull- Throws:
NullPointerException- The given parent cannot benull
-
InExpressionStateObject
Creates a newInExpressionStateObject.- Parameters:
parent- The parent of this state object, which cannot benullitems- The list of JPQL fragments that will be parsed and converted intoStateObject- Throws:
NullPointerException- The given parent cannot benull
-
-
Method Details
-
accept
Description copied from interface:StateObjectVisits thisStateObjectby the givenvisitor.- Parameters:
visitor- Thevisitorto visit this object
-
addChildren
Description copied from class:AbstractStateObjectAdds the children of thisStateObjectto the given list.- Overrides:
addChildrenin classAbstractListHolderStateObject<StateObject>- Parameters:
children- The list used to store the children
-
addNot
Makes sure theNOTidentifier is specified.- Returns:
- This object
-
getExpression
Description copied from interface:StateObjectReturns the actual parsed object if thisStateObjectrepresentation of the JPQL query was created by parsing an existing JPQL query.- Specified by:
getExpressionin interfaceStateObject- Overrides:
getExpressionin classAbstractStateObject- Returns:
- The parsed object when a JPQL query is parsed and converted into a
StateObjectornullwhen the JPQL query is manually created (i.e. not from a string)
-
getStateObject
Returns -
hasNot
public boolean hasNot()Determines whether theNOTidentifier is used or not.- Returns:
trueif theNOTidentifier is part of the expression;falseotherwise
-
hasStateObject
public boolean hasStateObject()Determines whether -
isEquivalent
Description copied from interface:StateObjectDetermines whether the givenStateObjectis equivalent to this one, i.e. the information of bothStateObjectis the same.- Specified by:
isEquivalentin interfaceStateObject- Overrides:
isEquivalentin classAbstractStateObject- Parameters:
stateObject- TheStateObjectto compare its content to this one- Returns:
trueif both object are equivalent;falseotherwise
-
isSingleInputParameter
public boolean isSingleInputParameter()Determines whether what was parsed after theINidentifier is a single input parameter.- Returns:
trueif the only item is an input parameter;falseotherwise
-
listName
Description copied from class:AbstractListHolderStateObjectReturns the name that is uniquely identifying the list.- Specified by:
listNamein classAbstractListHolderStateObject<StateObject>- Returns:
- The unique name identifying the list
-
parse
Parses the given JPQL fragment, which represents either a single or many items, the fragment will be parsed and converted intoStateObject.- Parameters:
jpqlFragment- The portion of the query to parse
-
removeNot
public void removeNot()Makes sure theNOTidentifier is not specified. -
setExpression
Keeps a reference of theparsed objectobject, which should only be done when this object is instantiated during the conversion of a parsed JPQL query intoStateObjects.- Parameters:
expression- Theparsed objectrepresenting anINexpression
-
setNot
public void setNot(boolean not) Sets whether theNOTidentifier should be part of the expression or not.- Parameters:
not-trueif theNOTidentifier should be part of the expression;falseotherwise
-
setSingleInputParameter
public void setSingleInputParameter(boolean singleInputParameter) Sets whether what was parsed after theINidentifier is a single input parameter.- Parameters:
singleInputParameter-trueif the only item is an input parameter;falseotherwise
-
setStateObject
Sets -
toggleNot
public void toggleNot()Changes the visibility state of theNOTidentifier. -
toTextInternal
Description copied from class:AbstractStateObjectPrints out a string representation of thisStateObject, which should not be used to define atruestring representation of a JPQL query but should be used for debugging purposes.- Specified by:
toTextInternalin classAbstractStateObject- Parameters:
writer- The writer used to print out the string representation- Throws:
IOException- This should never happens, it is only required becauseAppendableis used instead of any concrete class
-