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
- Author:
- Pascal Filion
-
-
Field Summary
Fields Modifier and Type Field Description static StringJOINS_LISTNotifies the content of the list ofJoinStateObjecthas changed.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JoinStateObjectaddInnerJoin(String path, String identificationVariable)Adds a newINNER JOINexpression to this declaration.JoinStateObjectaddJoin(String joinType)Adds a newJOINexpression to this declaration.JoinStateObjectaddJoin(String path, String identificationVariable)Adds a newJOINexpression to this declaration.JoinStateObjectaddJoin(String joinType, String path, String identificationVariable)Adds a newJOINexpression to this declaration.JoinStateObjectaddJoin(String joinType, ListIterator<String> paths, String identificationVariable)Adds a newJOINexpression to this declaration.JoinStateObjectaddLeftJoin(String path, String identificationVariable)Adds a newLEFT JOINexpression to this declaration.JoinStateObjectaddLeftOuterJoin(String path, String identificationVariable)Adds a newLEFT OUTER JOINexpression to this declaration.IdentificationVariableDeclarationgetExpression()Returns the actual parsed object if thisStateObjectrepresentation of the JPQL query was created by parsing an existing JPQL query.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.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.booleanisEquivalent(StateObject stateObject)Determines whether the givenStateObjectis equivalent to this one, i.e.voidparseJoin(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(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.-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject
addItem, addItems, addListChangeListener, canMoveDown, canMoveUp, getItem, hasItems, items, itemsSize, moveDown, moveUp, removeItem, removeItems, removeListChangeListener
-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
addPropertyChangeListener, children, decorate, equals, findIdentificationVariable, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getQueryBuilder, getRoot, getType, getType, getTypeHelper, getTypeRepository, hashCode, isDecorated, removePropertyChangeListener, setExpression, setParent, toString, toString, toText
-
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 String JOINS_LIST
Notifies the content of the list ofJoinStateObjecthas changed.- See Also:
- Constant Field Values
-
-
Method Detail
-
addInnerJoin
public JoinStateObject addInnerJoin(String path, 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(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(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
public JoinStateObject addJoin(String path, 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(String joinType, String path, 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(String path, 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(String path, 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
-
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 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 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
-
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
-
parseJoin
public void parseJoin(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(String identificationVariable)
Sets the new identification variable that will range over the "root".- Parameters:
identificationVariable- The new identification variable
-
setRootPath
public void setRootPath(String root)
Sets the "root" object for objects which may not be reachable by navigation.- Parameters:
root- The "root" object
-
-