Class AbstractIdentificationVariableDeclarationStateObject
java.lang.Object
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject<JoinStateObject>
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractIdentificationVariableDeclarationStateObject
- All Implemented Interfaces:
ListHolderStateObject<JoinStateObject>,StateObject,VariableDeclarationStateObject
- Direct Known Subclasses:
DerivedPathIdentificationVariableDeclarationStateObject,IdentificationVariableDeclarationStateObject
public abstract class AbstractIdentificationVariableDeclarationStateObject
extends AbstractListHolderStateObject<JoinStateObject>
implements VariableDeclarationStateObject
- Since:
- 2.4
- Version:
- 2.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringNotifies the content of the list ofJoinStateObjecthas changed. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a newAbstractIdentificationVariableDeclarationStateObject.protectedAbstractIdentificationVariableDeclarationStateObject(AbstractFromClauseStateObject parent, String root, String identificationVariable) Creates a newAbstractIdentificationVariableDeclarationStateObject. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddChildren(List<StateObject> children) Adds the children of thisStateObjectto the given list.addInnerJoin(String path, String identificationVariable) Adds a newINNER JOINexpression to this declaration.Adds a newJOINexpression to this declaration.Adds a newJOINexpression to this declaration.Adds a newJOINexpression to this declaration.addJoin(String joinType, ListIterator<String> paths, String identificationVariable) Adds a newJOINexpression to this declaration.addLeftJoin(String path, String identificationVariable) Adds a newLEFT JOINexpression to this declaration.addLeftOuterJoin(String path, String identificationVariable) Adds a newLEFT OUTER JOINexpression to this declaration.protected abstract AbstractRangeVariableDeclarationStateObjectCreatesReturns the actual parsed object if thisStateObjectrepresentation of the JPQL query was created by parsing an existing JPQL query.Returns the identification variable identifying the "root".Returns theIdentificationVariableStateObjectholding onto the identification variable.Returns the parent of thisStateObject.Returns theStateObjectrepresenting the range variable declaration portion.Returns the "root" object for objects which may not be reachable by navigation.Returns theStateObjectrepresenting the "root" for objects which may not be reachable by navigation.Returns theIdentificationVariableStateObjectthat are used by this state object.protected voidInitializes this state object.booleanisEquivalent(StateObject stateObject) Determines whether the givenStateObjectis equivalent to this one, i.e.protected StringlistName()Returns the name that is uniquely identifying the list.voidParses the given JPQL fragment that should contain a singleJOINexpression.voidsetExpression(IdentificationVariableDeclaration 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.voidsetIdentificationVariable(String identificationVariable) Sets the new identification variable that will range over the "root".voidsetRootPath(String root) Sets the "root" object for objects which may not be reachable by navigation.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, 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, 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
accept, addPropertyChangeListener, children, decorate, findIdentificationVariable, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getQueryBuilder, getRoot, isDecorated, removePropertyChangeListener, setParent, toString, toTextMethods inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.query.VariableDeclarationStateObject
getManagedType
-
Field Details
-
JOINS_LIST
Notifies the content of the list ofJoinStateObjecthas changed.- See Also:
-
-
Constructor Details
-
AbstractIdentificationVariableDeclarationStateObject
protected AbstractIdentificationVariableDeclarationStateObject(AbstractFromClauseStateObject parent) Creates a newAbstractIdentificationVariableDeclarationStateObject.- Parameters:
parent- The parent of this state object, which cannot benull- Throws:
NullPointerException- The given parent cannot benull
-
AbstractIdentificationVariableDeclarationStateObject
protected AbstractIdentificationVariableDeclarationStateObject(AbstractFromClauseStateObject parent, String root, String identificationVariable) Creates a newAbstractIdentificationVariableDeclarationStateObject.- Parameters:
parent- The parent of this state object, which cannot benullroot- The "root" objectidentificationVariable- The identification variable defining the given path- Throws:
NullPointerException- The given parent cannot benull
-
-
Method Details
-
addChildren
Description copied from class:AbstractStateObjectAdds the children of thisStateObjectto the given list.- Overrides:
addChildrenin classAbstractListHolderStateObject<JoinStateObject>- Parameters:
children- The list used to store the children
-
addInnerJoin
Adds a newINNER JOINexpression to this declaration.- Parameters:
path- The join association path expressionidentificationVariable- The new variable defining the join association path- Returns:
- A new
JoinStateObject
-
addJoin
Adds a newJOINexpression to this declaration.- Parameters:
joinType- One of the joining types:LEFT JOIN,LEFT OUTER JOIN,INNER JOINorJOIN- Returns:
- A new
JoinStateObject
-
addJoin
public JoinStateObject addJoin(String joinType, ListIterator<String> paths, String identificationVariable) Adds a newJOINexpression to this declaration.- Parameters:
joinType- One of the joining types:LEFT JOIN,LEFT OUTER JOIN,INNER JOINorJOINpaths- The join association path expressionidentificationVariable- The new variable defining the join association path- Returns:
- A new
JoinStateObject
-
addJoin
Adds a newJOINexpression to this declaration.- Parameters:
path- The join association path expressionidentificationVariable- The new variable defining the join association path- Returns:
- A new
JoinStateObject
-
addJoin
Adds a newJOINexpression to this declaration.- Parameters:
joinType- One of the joining types:LEFT JOIN,LEFT OUTER JOIN,INNER JOINorJOINpath- The join association path expressionidentificationVariable- The new variable defining the join association path- Returns:
- A new
JoinStateObject
-
addLeftJoin
Adds a newLEFT JOINexpression to this declaration.- Parameters:
path- The join association path expressionidentificationVariable- The new variable defining the join association path- Returns:
- A new
JoinStateObject
-
addLeftOuterJoin
Adds a newLEFT OUTER JOINexpression to this declaration.- Parameters:
path- The join association path expressionidentificationVariable- The new variable defining the join association path- Returns:
- A new
JoinStateObject
-
buildRangeVariableDeclarationStateObject
protected abstract AbstractRangeVariableDeclarationStateObject buildRangeVariableDeclarationStateObject()Creates -
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)
-
getIdentificationVariable
Returns the identification variable identifying the "root".- Returns:
- A case insensitive unique identifier declaring the "root" of the declaration
-
getIdentificationVariableStateObject
Returns theIdentificationVariableStateObjectholding onto the identification variable.- Returns:
- The
IdentificationVariableStateObject, which is nevernull
-
getParent
Description copied from interface:StateObjectReturns the parent of thisStateObject.- Specified by:
getParentin interfaceStateObject- Overrides:
getParentin classAbstractStateObject- Returns:
- Returns the parent of this
StateObject, which isnullonly when this is the root of the hierarchy
-
getRangeVariableDeclaration
Returns theStateObjectrepresenting the range variable declaration portion.- Returns:
- The concrete instance
-
getRootPath
Returns the "root" object for objects which may not be reachable by navigation.- Returns:
- The "root" object
-
getRootStateObject
Returns theStateObjectrepresenting the "root" for objects which may not be reachable by navigation.- Returns:
- The
StateObjectrepresenting one of the possible valid "root"
-
identificationVariables
Description copied from interface:VariableDeclarationStateObjectReturns theIdentificationVariableStateObjectthat are used by this state object. It is possible more than one declaration exists, like a range variable declaration has also joins and join fetches.- Specified by:
identificationVariablesin interfaceVariableDeclarationStateObject- Returns:
- The list of
IdentificationVariableStateObject
-
initialize
protected void initialize()Description copied from class:AbstractStateObjectInitializes this state object.- Overrides:
initializein classAbstractListHolderStateObject<JoinStateObject>
-
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
-
listName
Description copied from class:AbstractListHolderStateObjectReturns the name that is uniquely identifying the list.- Specified by:
listNamein classAbstractListHolderStateObject<JoinStateObject>- Returns:
- The unique name identifying the list
-
parseJoin
Parses the given JPQL fragment that should contain a singleJOINexpression.- Parameters:
jpqlFragment- The portion representing aJOINexpression
-
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 an identification variable declaration
-
setIdentificationVariable
Sets the new identification variable that will range over the "root".- Parameters:
identificationVariable- The new identification variable
-
setRootPath
Sets the "root" object for objects which may not be reachable by navigation.- Parameters:
root- The "root" object
-
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
-