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
Modifier and TypeFieldDescriptionstatic final String
Notifies the content of the list ofJoinStateObject
has changed. -
Constructor Summary
ModifierConstructorDescriptionprotected
Creates a newAbstractIdentificationVariableDeclarationStateObject
.protected
AbstractIdentificationVariableDeclarationStateObject
(AbstractFromClauseStateObject parent, String root, String identificationVariable) Creates a newAbstractIdentificationVariableDeclarationStateObject
. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addChildren
(List<StateObject> children) Adds the children of thisStateObject
to the given list.addInnerJoin
(String path, String identificationVariable) Adds a newINNER JOIN
expression to this declaration.Adds a newJOIN
expression to this declaration.Adds a newJOIN
expression to this declaration.Adds a newJOIN
expression to this declaration.addJoin
(String joinType, ListIterator<String> paths, String identificationVariable) Adds a newJOIN
expression to this declaration.addLeftJoin
(String path, String identificationVariable) Adds a newLEFT JOIN
expression to this declaration.addLeftOuterJoin
(String path, String identificationVariable) Adds a newLEFT OUTER JOIN
expression to this declaration.protected abstract AbstractRangeVariableDeclarationStateObject
CreatesReturns the actual parsed object if thisStateObject
representation of the JPQL query was created by parsing an existing JPQL query.Returns the identification variable identifying the "root".Returns theIdentificationVariableStateObject
holding onto the identification variable.Returns the parent of thisStateObject
.Returns theStateObject
representing the range variable declaration portion.Returns the "root" object for objects which may not be reachable by navigation.Returns theStateObject
representing the "root" for objects which may not be reachable by navigation.Returns theIdentificationVariableStateObject
that are used by this state object.protected void
Initializes this state object.boolean
isEquivalent
(StateObject stateObject) Determines whether the givenStateObject
is equivalent to this one, i.e.protected String
listName()
Returns the name that is uniquely identifying the list.void
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
(String identificationVariable) Sets the new identification variable that will range over the "root".void
setRootPath
(String root) Sets the "root" object for objects which may not be reachable by navigation.protected void
toTextInternal
(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 Details
-
JOINS_LIST
Notifies the content of the list ofJoinStateObject
has 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 benull
root
- The "root" objectidentificationVariable
- The identification variable defining the given path- Throws:
NullPointerException
- The given parent cannot benull
-
-
Method Details
-
addChildren
Description copied from class:AbstractStateObject
Adds the children of thisStateObject
to the given list.- Overrides:
addChildren
in classAbstractListHolderStateObject<JoinStateObject>
- Parameters:
children
- The list used to store the children
-
addInnerJoin
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
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(String joinType, ListIterator<String> paths, 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
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
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
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
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 -
getExpression
Description copied from interface:StateObject
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
Returns the identification variable identifying the "root".- Returns:
- A case insensitive unique identifier declaring the "root" of the declaration
-
getIdentificationVariableStateObject
Returns theIdentificationVariableStateObject
holding onto the identification variable.- Returns:
- The
IdentificationVariableStateObject
, which is nevernull
-
getParent
Description copied from interface:StateObject
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
Returns theStateObject
representing 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 theStateObject
representing the "root" for objects which may not be reachable by navigation.- Returns:
- The
StateObject
representing one of the possible valid "root"
-
identificationVariables
Description copied from interface:VariableDeclarationStateObject
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()Description copied from class:AbstractStateObject
Initializes this state object.- Overrides:
initialize
in classAbstractListHolderStateObject<JoinStateObject>
-
isEquivalent
Description copied from interface: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
Description copied from class:AbstractListHolderStateObject
Returns the name that is uniquely identifying the list.- Specified by:
listName
in classAbstractListHolderStateObject<JoinStateObject>
- Returns:
- The unique name identifying the list
-
parseJoin
Parses the given JPQL fragment that should contain a singleJOIN
expression.- Parameters:
jpqlFragment
- The portion representing aJOIN
expression
-
setExpression
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
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:AbstractStateObject
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:
IOException
- This should never happens, it is only required becauseAppendable
is used instead of any concrete class
-