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.String
JOINS_LIST
Notifies the content of the list ofJoinStateObject
has changed.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractIdentificationVariableDeclarationStateObject(AbstractFromClauseStateObject parent)
Creates a newAbstractIdentificationVariableDeclarationStateObject
.protected
AbstractIdentificationVariableDeclarationStateObject(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 void
addChildren(java.util.List<StateObject> children)
Adds the children of thisStateObject
to the given list.JoinStateObject
addInnerJoin(java.lang.String path, java.lang.String identificationVariable)
Adds a newINNER JOIN
expression to this declaration.JoinStateObject
addJoin(java.lang.String joinType)
Adds a newJOIN
expression to this declaration.JoinStateObject
addJoin(java.lang.String path, java.lang.String identificationVariable)
Adds a newJOIN
expression to this declaration.JoinStateObject
addJoin(java.lang.String joinType, java.lang.String path, java.lang.String identificationVariable)
Adds a newJOIN
expression to this declaration.JoinStateObject
addJoin(java.lang.String joinType, java.util.ListIterator<java.lang.String> paths, java.lang.String identificationVariable)
Adds a newJOIN
expression to this declaration.JoinStateObject
addLeftJoin(java.lang.String path, java.lang.String identificationVariable)
Adds a newLEFT JOIN
expression to this declaration.JoinStateObject
addLeftOuterJoin(java.lang.String path, java.lang.String identificationVariable)
Adds a newLEFT OUTER JOIN
expression to this declaration.protected abstract AbstractRangeVariableDeclarationStateObject
buildRangeVariableDeclarationStateObject()
CreatesIdentificationVariableDeclaration
getExpression()
Returns the actual parsed object if thisStateObject
representation of the JPQL query was created by parsing an existing JPQL query.java.lang.String
getIdentificationVariable()
Returns the identification variable identifying the "root".IdentificationVariableStateObject
getIdentificationVariableStateObject()
Returns theIdentificationVariableStateObject
holding onto the identification variable.AbstractFromClauseStateObject
getParent()
Returns the parent of thisStateObject
.AbstractRangeVariableDeclarationStateObject
getRangeVariableDeclaration()
Returns theStateObject
representing the range variable declaration portion.java.lang.String
getRootPath()
Returns the "root" object for objects which may not be reachable by navigation.StateObject
getRootStateObject()
Returns theStateObject
representing the "root" for objects which may not be reachable by navigation.ListIterable<IdentificationVariableStateObject>
identificationVariables()
Returns theIdentificationVariableStateObject
that are used by this state object.protected void
initialize()
Initializes this state object.boolean
isEquivalent(StateObject stateObject)
Determines whether the givenStateObject
is equivalent to this one, i.e. the information of bothStateObject
is the same.protected java.lang.String
listName()
Returns the name that is uniquely identifying the list.void
parseJoin(java.lang.String jpqlFragment)
Parses the given JPQL fragment that should contain a singleJOIN
expression.void
setExpression(IdentificationVariableDeclaration expression)
Keeps a reference of theparsed object
object, which should only be done when this object is instantiated during the conversion of a parsed JPQL query intoStateObjects
.void
setIdentificationVariable(java.lang.String identificationVariable)
Sets the new identification variable that will range over the "root".void
setRootPath(java.lang.String root)
Sets the "root" object for objects which may not be reachable by navigation.protected void
toTextInternal(java.lang.Appendable writer)
Prints out a string representation of thisStateObject
, which should not be used to define atrue
string 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 ofJoinStateObject
has 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 benull
root
- 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 thisStateObject
to the given list.- Overrides:
addChildren
in 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 JOIN
expression 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 newJOIN
expression to this declaration.- Parameters:
joinType
- One of the joining types:LEFT JOIN
,LEFT OUTER JOIN
,INNER JOIN
orJOIN
- 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 newJOIN
expression to this declaration.- Parameters:
joinType
- One of the joining types:LEFT JOIN
,LEFT OUTER JOIN
,INNER JOIN
orJOIN
paths
- 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 newJOIN
expression 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 newJOIN
expression to this declaration.- Parameters:
joinType
- One of the joining types:LEFT JOIN
,LEFT OUTER JOIN
,INNER JOIN
orJOIN
path
- 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 JOIN
expression 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 JOIN
expression 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 thisStateObject
representation of the JPQL query was created by parsing an existing JPQL query.- Specified by:
getExpression
in interfaceStateObject
- Overrides:
getExpression
in classAbstractStateObject
- Returns:
- The parsed object when a JPQL query is parsed and converted into a
StateObject
ornull
when 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 theIdentificationVariableStateObject
holding onto the identification variable.- Returns:
- The
IdentificationVariableStateObject
, which is nevernull
-
getParent
public AbstractFromClauseStateObject getParent()
Returns the parent of thisStateObject
.- Specified by:
getParent
in interfaceStateObject
- Overrides:
getParent
in classAbstractStateObject
- Returns:
- Returns the parent of this
StateObject
, which isnull
only when this is the root of the hierarchy
-
getRangeVariableDeclaration
public AbstractRangeVariableDeclarationStateObject getRangeVariableDeclaration()
Returns theStateObject
representing 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 theStateObject
representing the "root" for objects which may not be reachable by navigation.- Returns:
- The
StateObject
representing one of the possible valid "root"
-
identificationVariables
public ListIterable<IdentificationVariableStateObject> identificationVariables()
Returns theIdentificationVariableStateObject
that 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:
identificationVariables
in interfaceVariableDeclarationStateObject
- Returns:
- The list of
IdentificationVariableStateObject
-
initialize
protected void initialize()
Initializes this state object.- Overrides:
initialize
in classAbstractListHolderStateObject<JoinStateObject>
-
isEquivalent
public boolean isEquivalent(StateObject stateObject)
Determines whether the givenStateObject
is equivalent to this one, i.e. the information of bothStateObject
is the same.- Specified by:
isEquivalent
in interfaceStateObject
- Overrides:
isEquivalent
in classAbstractStateObject
- Parameters:
stateObject
- TheStateObject
to compare its content to this one- Returns:
true
if both object are equivalent;false
otherwise
-
listName
protected java.lang.String listName()
Returns the name that is uniquely identifying the list.- Specified by:
listName
in 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 singleJOIN
expression.- Parameters:
jpqlFragment
- The portion representing aJOIN
expression
-
setExpression
public void setExpression(IdentificationVariableDeclaration expression)
Keeps a reference of theparsed object
object, which should only be done when this object is instantiated during the conversion of a parsed JPQL query intoStateObjects
.- Parameters:
expression
- Theparsed object
representing 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.IOException
Prints out a string representation of thisStateObject
, which should not be used to define atrue
string representation of a JPQL query but should be used for debugging purposes.- Specified by:
toTextInternal
in classAbstractStateObject
- Parameters:
writer
- The writer used to print out the string representation- Throws:
java.io.IOException
- This should never happens, it is only required becauseAppendable
is used instead of any concrete class
-
-