EclipseLink 2.4.2, build 'v20130514-5956486' API Reference

org.eclipse.persistence.jpa.jpql.model.query
Class AbstractIdentificationVariableDeclarationStateObject

java.lang.Object
  extended by org.eclipse.persistence.jpa.jpql.model.query.AbstractStateObject
      extended by org.eclipse.persistence.jpa.jpql.model.query.AbstractListHolderStateObject<JoinStateObject>
          extended by org.eclipse.persistence.jpa.jpql.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.4
Author:
Pascal Filion
Since:
2.4

Field Summary
static java.lang.String JOINS_LIST
          Notifies the content of the list of JoinStateObject has changed.
 
Constructor Summary
protected AbstractIdentificationVariableDeclarationStateObject(AbstractFromClauseStateObject parent)
          Creates a new AbstractIdentificationVariableDeclarationStateObject.
protected AbstractIdentificationVariableDeclarationStateObject(AbstractFromClauseStateObject parent, java.lang.String root, java.lang.String identificationVariable)
          Creates a new AbstractIdentificationVariableDeclarationStateObject.
 
Method Summary
protected  void addChildren(java.util.List<StateObject> children)
          Adds the children of this StateObject to the given list.
 JoinStateObject addInnerJoin(java.lang.String path, java.lang.String identificationVariable)
          Adds a new INNER JOIN expression to this declaration.
 JoinStateObject addJoin(java.lang.String joinType)
          Adds a new JOIN expression to this declaration.
 JoinStateObject addJoin(java.lang.String joinType, java.util.ListIterator<java.lang.String> paths, java.lang.String identificationVariable)
          Adds a new JOIN expression to this declaration.
 JoinStateObject addJoin(java.lang.String path, java.lang.String identificationVariable)
          Adds a new JOIN expression to this declaration.
 JoinStateObject addJoin(java.lang.String joinType, java.lang.String path, java.lang.String identificationVariable)
          Adds a new JOIN expression to this declaration.
 JoinStateObject addLeftJoin(java.lang.String path, java.lang.String identificationVariable)
          Adds a new LEFT JOIN expression to this declaration.
 JoinStateObject addLeftOuterJoin(java.lang.String path, java.lang.String identificationVariable)
          Adds a new LEFT OUTER JOIN expression to this declaration.
protected abstract  AbstractRangeVariableDeclarationStateObject buildRangeVariableDeclarationStateObject()
          Creates
 IdentificationVariableDeclaration getExpression()
          Returns the actual parsed object if this StateObject 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 the IdentificationVariableStateObject holding onto the identification variable.
 AbstractFromClauseStateObject getParent()
          Returns the parent of this StateObject.
 AbstractRangeVariableDeclarationStateObject getRangeVariableDeclaration()
          Returns the StateObject 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 the StateObject representing the "root" for objects which may not be reachable by navigation.
 IterableListIterator<IdentificationVariableStateObject> identificationVariables()
          Returns the IdentificationVariableStateObject that are used by this state object.
protected  void initialize()
          Initializes this state object.
 boolean isEquivalent(StateObject stateObject)
          Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject 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 single JOIN expression.
 void setExpression(IdentificationVariableDeclaration expression)
          Keeps a reference of the parsed object object, which should only be done when this object is instantiated during the conversion of a parsed JPQL query into StateObjects.
 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 this StateObject, which should not be used to define a true string representation of a JPQL query but should be used for debugging purposes.
 
Methods inherited from class org.eclipse.persistence.jpa.jpql.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.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.model.query.VariableDeclarationStateObject
getManagedType
 
Methods inherited from interface org.eclipse.persistence.jpa.jpql.model.query.StateObject
accept, addPropertyChangeListener, children, decorate, findIdentificationVariable, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getQueryBuilder, getRoot, isDecorated, removePropertyChangeListener, setParent, toString, toText
 

Field Detail

JOINS_LIST

public static final java.lang.String JOINS_LIST
Notifies the content of the list of JoinStateObject has changed.

See Also:
Constant Field Values
Constructor Detail

AbstractIdentificationVariableDeclarationStateObject

protected AbstractIdentificationVariableDeclarationStateObject(AbstractFromClauseStateObject parent)
Creates a new AbstractIdentificationVariableDeclarationStateObject.

Parameters:
parent - The parent of this state object, which cannot be null
Throws:
java.lang.NullPointerException - The given parent cannot be null

AbstractIdentificationVariableDeclarationStateObject

protected AbstractIdentificationVariableDeclarationStateObject(AbstractFromClauseStateObject parent,
                                                               java.lang.String root,
                                                               java.lang.String identificationVariable)
Creates a new AbstractIdentificationVariableDeclarationStateObject.

Parameters:
parent - The parent of this state object, which cannot be null
root - The "root" object
identificationVariable - The identification variable defining the given path
Throws:
java.lang.NullPointerException - The given parent cannot be null
Method Detail

addChildren

protected void addChildren(java.util.List<StateObject> children)
Adds the children of this StateObject to the given list.

Overrides:
addChildren in class AbstractListHolderStateObject<JoinStateObject>
Parameters:
children - The list used to store the children

addInnerJoin

public JoinStateObject addInnerJoin(java.lang.String path,
                                    java.lang.String identificationVariable)
Adds a new INNER JOIN expression to this declaration.

Parameters:
path - The join association path expression
identificationVariable - The new variable defining the join association path
Returns:
A new JoinStateObject

addJoin

public JoinStateObject addJoin(java.lang.String joinType)
Adds a new JOIN expression to this declaration.

Parameters:
joinType - One of the joining types: LEFT JOIN, LEFT OUTER JOIN, INNER JOIN or JOIN
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 new JOIN expression to this declaration.

Parameters:
joinType - One of the joining types: LEFT JOIN, LEFT OUTER JOIN, INNER JOIN or JOIN
paths - The join association path expression
identificationVariable - 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 new JOIN expression to this declaration.

Parameters:
path - The join association path expression
identificationVariable - 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 new JOIN expression to this declaration.

Parameters:
joinType - One of the joining types: LEFT JOIN, LEFT OUTER JOIN, INNER JOIN or JOIN
path - The join association path expression
identificationVariable - 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 new LEFT JOIN expression to this declaration.

Parameters:
path - The join association path expression
identificationVariable - 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 new LEFT OUTER JOIN expression to this declaration.

Parameters:
path - The join association path expression
identificationVariable - 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 this StateObject representation of the JPQL query was created by parsing an existing JPQL query.

Specified by:
getExpression in interface StateObject
Overrides:
getExpression in class AbstractStateObject
Returns:
The parsed object when a JPQL query is parsed and converted into a StateObject or null 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 the IdentificationVariableStateObject holding onto the identification variable.

Returns:
The IdentificationVariableStateObject, which is never null

getParent

public AbstractFromClauseStateObject getParent()
Returns the parent of this StateObject.

Specified by:
getParent in interface StateObject
Overrides:
getParent in class AbstractStateObject
Returns:
Returns the parent of this StateObject, which is null only when this is the root of the hierarchy

getRangeVariableDeclaration

public AbstractRangeVariableDeclarationStateObject getRangeVariableDeclaration()
Returns the StateObject 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 the StateObject representing the "root" for objects which may not be reachable by navigation.

Returns:
The StateObject representing one of the possible valid "root"

identificationVariables

public IterableListIterator<IdentificationVariableStateObject> identificationVariables()
Returns the IdentificationVariableStateObject 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 interface VariableDeclarationStateObject
Returns:
The list of IdentificationVariableStateObject

initialize

protected void initialize()
Initializes this state object.

Overrides:
initialize in class AbstractListHolderStateObject<JoinStateObject>

isEquivalent

public boolean isEquivalent(StateObject stateObject)
Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.

Specified by:
isEquivalent in interface StateObject
Overrides:
isEquivalent in class AbstractStateObject
Parameters:
stateObject - The StateObject 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 class AbstractListHolderStateObject<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 single JOIN expression.

Parameters:
jpqlFragment - The portion representing a JOIN expression

setExpression

public void setExpression(IdentificationVariableDeclaration expression)
Keeps a reference of the parsed object object, which should only be done when this object is instantiated during the conversion of a parsed JPQL query into StateObjects.

Parameters:
expression - The parsed 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 this StateObject, which should not be used to define a true string representation of a JPQL query but should be used for debugging purposes.

Specified by:
toTextInternal in class AbstractStateObject
Parameters:
writer - The writer used to print out the string representation
Throws:
java.io.IOException - This should never happens, it is only required because Appendable is used instead of any concrete class

EclipseLink 2.4.2, build 'v20130514-5956486' API Reference