EclipseLink 2.4.2, build 'v20130514-5956486' API Reference

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

java.lang.Object
  extended by org.eclipse.persistence.jpa.jpql.model.query.AbstractStateObject
      extended by org.eclipse.persistence.jpa.jpql.model.query.AbstractRangeVariableDeclarationStateObject
All Implemented Interfaces:
StateObject, VariableDeclarationStateObject
Direct Known Subclasses:
DerivedPathVariableDeclarationStateObject, RangeVariableDeclarationStateObject

public abstract class AbstractRangeVariableDeclarationStateObject
extends AbstractStateObject
implements VariableDeclarationStateObject

Version:
2.4
Author:
Pascal Filion
Since:
2.4

Field Summary
static java.lang.String AS_PROPERTY
          Notifies the visibility of the AS identifier has changed.
static java.lang.String IDENTIFICATION_VARIABLE_PROPERTY
          Notifies the identification variable property has changed.
 
Constructor Summary
AbstractRangeVariableDeclarationStateObject(AbstractIdentificationVariableDeclarationStateObject parent)
          Creates a new RangeVariableDeclarationStateObject.
AbstractRangeVariableDeclarationStateObject(AbstractIdentificationVariableDeclarationStateObject parent, java.lang.String root)
          Creates a new RangeVariableDeclarationStateObject.
AbstractRangeVariableDeclarationStateObject(AbstractModifyClauseStateObject parent)
          Creates a new AbstractRangeVariableDeclarationStateObject.
 
Method Summary
 AbstractRangeVariableDeclarationStateObject addAs()
          Makes sure the AS identifier is specified.
protected  void addChildren(java.util.List<StateObject> children)
          Adds the children of this StateObject to the given list.
protected  void addProblems(java.util.List<Problem> problems)
          Adds to the given list the problems that were found with the current state of this StateObject, which means there are validation issues.
protected abstract  StateObject buildRootStateObject()
           
 RangeVariableDeclaration 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 name that is ranging over the abstract schema type.
 IdentificationVariableStateObject getIdentificationVariableStateObject()
          Returns the IdentificationVariableStateObject holding onto the identification variable.
abstract  java.lang.String getRootPath()
          Returns the "root" object for objects which may not be reachable by navigation.
 StateObject getRootStateObject()
          Returns the StateObject holding onto the abstract schema name.
 boolean hasAs()
          Determines whether the AS identifier is used or not.
 boolean hasIdentificationVariable()
          Determines whether an identification variable was defined.
 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.
 boolean isIdentificationVariableOptional()
          Determines whether the identification variable is optional or not.
 boolean isIdentificationVariableVirtual()
          Determines whether this identification variable is virtual, meaning it's not part of the query but is required for proper navigability.
 void setAs(boolean as)
          Sets whether the AS identifier is used or not.
 void setExpression(RangeVariableDeclaration 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" object.
protected  void setIdentificationVariableOptional(boolean identificationVariableOptional)
          Sets whether the identification variable is optional or not.
abstract  void setRootPath(java.lang.String root)
          Sets the "root" object for objects which may not be reachable by navigation.
 void toggleAs()
          Toggles the usage of the AS identifier.
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.AbstractStateObject
acceptUnknownVisitor, acceptUnknownVisitor, addPropertyChangeListener, areEquivalent, buildProblem, buildProblem, buildStateObject, buildStateObjects, checkParent, children, decorate, equals, findIdentificationVariable, firePropertyChanged, getChangeSupport, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getParent, 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, getParent, getQueryBuilder, getRoot, isDecorated, removePropertyChangeListener, setParent, toString, toText
 

Field Detail

AS_PROPERTY

public static final java.lang.String AS_PROPERTY
Notifies the visibility of the AS identifier has changed.

See Also:
Constant Field Values

IDENTIFICATION_VARIABLE_PROPERTY

public static final java.lang.String IDENTIFICATION_VARIABLE_PROPERTY
Notifies the identification variable property has changed.

See Also:
Constant Field Values
Constructor Detail

AbstractRangeVariableDeclarationStateObject

public AbstractRangeVariableDeclarationStateObject(AbstractIdentificationVariableDeclarationStateObject parent)
Creates a new RangeVariableDeclarationStateObject.

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

AbstractRangeVariableDeclarationStateObject

public AbstractRangeVariableDeclarationStateObject(AbstractIdentificationVariableDeclarationStateObject parent,
                                                   java.lang.String root)
Creates a new RangeVariableDeclarationStateObject.

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

AbstractRangeVariableDeclarationStateObject

public AbstractRangeVariableDeclarationStateObject(AbstractModifyClauseStateObject parent)
Creates a new AbstractRangeVariableDeclarationStateObject.

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

addAs

public AbstractRangeVariableDeclarationStateObject addAs()
Makes sure the AS identifier is specified.

Returns:
This object

addChildren

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

Overrides:
addChildren in class AbstractStateObject
Parameters:
children - The list used to store the children

addProblems

protected void addProblems(java.util.List<Problem> problems)
Adds to the given list the problems that were found with the current state of this StateObject, which means there are validation issues.

Overrides:
addProblems in class AbstractStateObject
Parameters:
problems - The list to which the problems are added

buildRootStateObject

protected abstract StateObject buildRootStateObject()

getExpression

public RangeVariableDeclaration 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 name that is ranging over the abstract schema type.

Returns:
The identification variable name

getIdentificationVariableStateObject

public IdentificationVariableStateObject getIdentificationVariableStateObject()
Returns the IdentificationVariableStateObject holding onto the identification variable.

Returns:
The IdentificationVariableStateObject, which is never null

getRootPath

public abstract 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 holding onto the abstract schema name.

Returns:
The StateObject, which is never null

hasAs

public boolean hasAs()
Determines whether the AS identifier is used or not.

Returns:
true if the AS identifier is part of the expression; false otherwise

hasIdentificationVariable

public boolean hasIdentificationVariable()
Determines whether an identification variable was defined.

Returns:
true if an identification variable is defined; false otherwise

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 AbstractStateObject

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

isIdentificationVariableOptional

public boolean isIdentificationVariableOptional()
Determines whether the identification variable is optional or not. The only time it is optional is when this model is used in a modify clause (DELETE or UPDATE).

Returns:
true if an identification variable is not required; false if it is required

isIdentificationVariableVirtual

public boolean isIdentificationVariableVirtual()
Determines whether this identification variable is virtual, meaning it's not part of the query but is required for proper navigability.

Returns:
true if this identification variable was virtually created to fully qualify path expression; false if it was parsed

setAs

public void setAs(boolean as)
Sets whether the AS identifier is used or not.

Parameters:
as - true if the AS identifier is part of the expression; false otherwise

setExpression

public void setExpression(RangeVariableDeclaration 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 a range variable declaration

setIdentificationVariable

public void setIdentificationVariable(java.lang.String identificationVariable)
Sets the new identification variable that will range over the "root" object.

Parameters:
identificationVariable - The new identification variable

setIdentificationVariableOptional

protected void setIdentificationVariableOptional(boolean identificationVariableOptional)
Sets whether the identification variable is optional or not. The only time it is optional is when this model is used in a modify clause (DELETE or UPDATE).

Parameters:
identificationVariableOptional - true if an identification variable is not required; false if it is required

setRootPath

public abstract void setRootPath(java.lang.String root)
Sets the "root" object for objects which may not be reachable by navigation.

Parameters:
root - The "root" object

toggleAs

public void toggleAs()
Toggles the usage of the AS identifier.


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