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
- Version:
- 2.5
- Author:
- Pascal Filion
- Since:
- 2.4
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringJOINS_LISTNotifies the content of the list ofJoinStateObjecthas changed.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractIdentificationVariableDeclarationStateObject(AbstractFromClauseStateObject parent)Creates a newAbstractIdentificationVariableDeclarationStateObject.protectedAbstractIdentificationVariableDeclarationStateObject(AbstractFromClauseStateObject parent, java.lang.String root, java.lang.String identificationVariable)Creates a newAbstractIdentificationVariableDeclarationStateObject.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddChildren(java.util.List<StateObject> children)Adds the children of thisStateObjectto the given list.JoinStateObjectaddInnerJoin(java.lang.String path, java.lang.String identificationVariable)Adds a newINNER JOINexpression to this declaration.JoinStateObjectaddJoin(java.lang.String joinType)Adds a newJOINexpression to this declaration.JoinStateObjectaddJoin(java.lang.String path, java.lang.String identificationVariable)Adds a newJOINexpression to this declaration.JoinStateObjectaddJoin(java.lang.String joinType, java.lang.String path, java.lang.String identificationVariable)Adds a newJOINexpression to this declaration.JoinStateObjectaddJoin(java.lang.String joinType, java.util.ListIterator<java.lang.String> paths, java.lang.String identificationVariable)Adds a newJOINexpression to this declaration.JoinStateObjectaddLeftJoin(java.lang.String path, java.lang.String identificationVariable)Adds a newLEFT JOINexpression to this declaration.JoinStateObjectaddLeftOuterJoin(java.lang.String path, java.lang.String identificationVariable)Adds a newLEFT OUTER JOINexpression to this declaration.protected abstract AbstractRangeVariableDeclarationStateObjectbuildRangeVariableDeclarationStateObject()CreatesIdentificationVariableDeclarationgetExpression()Returns the actual parsed object if thisStateObjectrepresentation of the JPQL query was created by parsing an existing JPQL query.java.lang.StringgetIdentificationVariable()Returns the identification variable identifying the "root".IdentificationVariableStateObjectgetIdentificationVariableStateObject()Returns theIdentificationVariableStateObjectholding onto the identification variable.AbstractFromClauseStateObjectgetParent()Returns the parent of thisStateObject.AbstractRangeVariableDeclarationStateObjectgetRangeVariableDeclaration()Returns theStateObjectrepresenting the range variable declaration portion.java.lang.StringgetRootPath()Returns the "root" object for objects which may not be reachable by navigation.StateObjectgetRootStateObject()Returns theStateObjectrepresenting the "root" for objects which may not be reachable by navigation.ListIterable<IdentificationVariableStateObject>identificationVariables()Returns theIdentificationVariableStateObjectthat are used by this state object.protected voidinitialize()Initializes this state object.booleanisEquivalent(StateObject stateObject)Determines whether the givenStateObjectis equivalent to this one, i.e. the information of bothStateObjectis the same.protected java.lang.StringlistName()Returns the name that is uniquely identifying the list.voidparseJoin(java.lang.String jpqlFragment)Parses 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(java.lang.String identificationVariable)Sets the new identification variable that will range over the "root".voidsetRootPath(java.lang.String root)Sets the "root" object for objects which may not be reachable by navigation.protected voidtoTextInternal(java.lang.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, toStringItems
-
Methods 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, toText
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods 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, toText
-
Methods inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.query.VariableDeclarationStateObject
getManagedType
-
-
-
-
Field Detail
-
JOINS_LIST
public static final java.lang.String JOINS_LIST
Notifies the content of the list ofJoinStateObjecthas changed.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractIdentificationVariableDeclarationStateObject
protected AbstractIdentificationVariableDeclarationStateObject(AbstractFromClauseStateObject parent)
Creates a newAbstractIdentificationVariableDeclarationStateObject.- Parameters:
parent- The parent of this state object, which cannot benull- Throws:
java.lang.NullPointerException- The given parent cannot benull
-
AbstractIdentificationVariableDeclarationStateObject
protected AbstractIdentificationVariableDeclarationStateObject(AbstractFromClauseStateObject parent, java.lang.String root, java.lang.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:
java.lang.NullPointerException- The given parent cannot benull
-
-
Method Detail
-
addChildren
protected void addChildren(java.util.List<StateObject> children)
Adds the children of thisStateObjectto the given list.- Overrides:
addChildrenin classAbstractListHolderStateObject<JoinStateObject>- Parameters:
children- The list used to store the children
-
addInnerJoin
public JoinStateObject addInnerJoin(java.lang.String path, java.lang.String identificationVariable)
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
public JoinStateObject addJoin(java.lang.String joinType)
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(java.lang.String joinType, java.util.ListIterator<java.lang.String> paths, java.lang.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
public JoinStateObject addJoin(java.lang.String path, java.lang.String identificationVariable)
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
public JoinStateObject addJoin(java.lang.String joinType, java.lang.String path, java.lang.String identificationVariable)
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
public JoinStateObject addLeftJoin(java.lang.String path, java.lang.String identificationVariable)
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
public JoinStateObject addLeftOuterJoin(java.lang.String path, java.lang.String identificationVariable)
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- Returns:
-
getExpression
public IdentificationVariableDeclaration getExpression()
Returns 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
public java.lang.String getIdentificationVariable()
Returns the identification variable identifying the "root".- Returns:
- A case insensitive unique identifier declaring the "root" of the declaration
-
getIdentificationVariableStateObject
public IdentificationVariableStateObject getIdentificationVariableStateObject()
Returns theIdentificationVariableStateObjectholding onto the identification variable.- Returns:
- The
IdentificationVariableStateObject, which is nevernull
-
getParent
public AbstractFromClauseStateObject getParent()
Returns 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
public AbstractRangeVariableDeclarationStateObject getRangeVariableDeclaration()
Returns theStateObjectrepresenting the range variable declaration portion.- Returns:
- The concrete instance
-
getRootPath
public java.lang.String getRootPath()
Returns the "root" object for objects which may not be reachable by navigation.- Returns:
- The "root" object
-
getRootStateObject
public StateObject getRootStateObject()
Returns theStateObjectrepresenting the "root" for objects which may not be reachable by navigation.- Returns:
- The
StateObjectrepresenting one of the possible valid "root"
-
identificationVariables
public ListIterable<IdentificationVariableStateObject> identificationVariables()
Returns 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()
Initializes this state object.- Overrides:
initializein classAbstractListHolderStateObject<JoinStateObject>
-
isEquivalent
public boolean isEquivalent(StateObject stateObject)
Determines 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
protected java.lang.String listName()
Returns the name that is uniquely identifying the list.- Specified by:
listNamein classAbstractListHolderStateObject<JoinStateObject>- Returns:
- The unique name identifying the list
-
parseJoin
public void parseJoin(java.lang.String jpqlFragment)
Parses the given JPQL fragment that should contain a singleJOINexpression.- Parameters:
jpqlFragment- The portion representing aJOINexpression
-
setExpression
public void setExpression(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.- Parameters:
expression- Theparsed objectrepresenting an identification variable declaration
-
setIdentificationVariable
public void setIdentificationVariable(java.lang.String identificationVariable)
Sets the new identification variable that will range over the "root".- Parameters:
identificationVariable- The new identification variable
-
setRootPath
public void setRootPath(java.lang.String root)
Sets the "root" object for objects which may not be reachable by navigation.- Parameters:
root- The "root" object
-
toTextInternal
protected void toTextInternal(java.lang.Appendable writer) throws java.io.IOExceptionPrints 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:
java.io.IOException- This should never happens, it is only required becauseAppendableis used instead of any concrete class
-
-