Class AbstractRangeVariableDeclarationStateObject
java.lang.Object
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractRangeVariableDeclarationStateObject
- All Implemented Interfaces:
StateObject,VariableDeclarationStateObject
- Direct Known Subclasses:
DerivedPathVariableDeclarationStateObject,RangeVariableDeclarationStateObject
public abstract class AbstractRangeVariableDeclarationStateObject
extends AbstractStateObject
implements VariableDeclarationStateObject
- Since:
- 2.4
- Version:
- 2.5
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractRangeVariableDeclarationStateObject(AbstractIdentificationVariableDeclarationStateObject parent) Creates a newRangeVariableDeclarationStateObject.AbstractRangeVariableDeclarationStateObject(AbstractIdentificationVariableDeclarationStateObject parent, String root) Creates a newRangeVariableDeclarationStateObject.Creates a newAbstractRangeVariableDeclarationStateObject. -
Method Summary
Modifier and TypeMethodDescriptionaddAs()Makes sure theASidentifier is specified.protected voidaddChildren(List<StateObject> children) Adds the children of thisStateObjectto the given list.protected voidaddProblems(List<Problem> problems) Adds to the given list the problems that were found with the current state of thisStateObject, which means there are validation issues.protected abstract StateObjectReturns the actual parsed object if thisStateObjectrepresentation of the JPQL query was created by parsing an existing JPQL query.Returns the identification variable name that is ranging over the abstract schema type.Returns theIdentificationVariableStateObjectholding onto the identification variable.abstract StringReturns the "root" object for objects which may not be reachable by navigation.Returns theStateObjectholding onto the abstract schema name.booleanhasAs()Determines whether theASidentifier is used or not.booleanDetermines whether an identification variable was defined.Returns theIdentificationVariableStateObjectthat are used by this state object.protected voidInitializes this state object.booleanisEquivalent(StateObject stateObject) Determines whether the givenStateObjectis equivalent to this one, i.e.booleanDetermines whether the identification variable is optional or not.booleanDetermines whether this identification variable is virtual, meaning it's not part of the query but is required for proper navigability.voidsetAs(boolean as) Sets whether theASidentifier is used or not.voidsetExpression(RangeVariableDeclaration 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" object.protected voidsetIdentificationVariableOptional(boolean identificationVariableOptional) Sets whether the identification variable is optional or not.abstract voidsetRootPath(String root) Sets the "root" object for objects which may not be reachable by navigation.voidtoggleAs()Toggles the usage of theASidentifier.protected voidtoTextInternal(Appendable writer) Prints out a string representation of thisStateObject, which should not be used to define atruestring representation of a JPQL query but should be used for debugging purposes.Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.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, toTextMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject
accept, addPropertyChangeListener, children, decorate, findIdentificationVariable, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getParent, getQueryBuilder, getRoot, isDecorated, removePropertyChangeListener, setParent, toString, toTextMethods inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.query.VariableDeclarationStateObject
getManagedType
-
Field Details
-
AS_PROPERTY
Notifies the visibility of theASidentifier has changed.- See Also:
-
IDENTIFICATION_VARIABLE_PROPERTY
Notifies the identification variable property has changed.- See Also:
-
-
Constructor Details
-
AbstractRangeVariableDeclarationStateObject
public AbstractRangeVariableDeclarationStateObject(AbstractIdentificationVariableDeclarationStateObject parent) Creates a newRangeVariableDeclarationStateObject.- Parameters:
parent- The parent of this state object, which cannot benull- Throws:
NullPointerException- The given parent cannot benull
-
AbstractRangeVariableDeclarationStateObject
public AbstractRangeVariableDeclarationStateObject(AbstractIdentificationVariableDeclarationStateObject parent, String root) Creates a newRangeVariableDeclarationStateObject.- Parameters:
parent- The parent of this state object, which cannot benull- Throws:
NullPointerException- The given parent cannot benull
-
AbstractRangeVariableDeclarationStateObject
Creates a newAbstractRangeVariableDeclarationStateObject.- Parameters:
parent- The parent of this state object, which cannot benull- Throws:
NullPointerException- The given parent cannot benull
-
-
Method Details
-
addAs
Makes sure theASidentifier is specified.- Returns:
- This object
-
addChildren
Description copied from class:AbstractStateObjectAdds the children of thisStateObjectto the given list.- Overrides:
addChildrenin classAbstractStateObject- Parameters:
children- The list used to store the children
-
addProblems
Description copied from class:AbstractStateObjectAdds to the given list the problems that were found with the current state of thisStateObject, which means there are validation issues.- Overrides:
addProblemsin classAbstractStateObject- Parameters:
problems- The list to which the problems are added
-
buildRootStateObject
-
getExpression
Description copied from interface:StateObjectReturns 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
Returns the identification variable name that is ranging over the abstract schema type.- Returns:
- The identification variable name
-
getIdentificationVariableStateObject
Returns theIdentificationVariableStateObjectholding onto the identification variable.- Returns:
- The
IdentificationVariableStateObject, which is nevernull
-
getRootPath
Returns the "root" object for objects which may not be reachable by navigation.- Returns:
- The "root" object
-
getRootStateObject
Returns theStateObjectholding onto the abstract schema name.- Returns:
- The
StateObject, which is nevernull
-
hasAs
public boolean hasAs()Determines whether theASidentifier is used or not.- Returns:
trueif theASidentifier is part of the expression;falseotherwise
-
hasIdentificationVariable
public boolean hasIdentificationVariable()Determines whether an identification variable was defined.- Returns:
trueif an identification variable is defined;falseotherwise
-
identificationVariables
Description copied from interface:VariableDeclarationStateObjectReturns 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
-
initialize
protected void initialize()Description copied from class:AbstractStateObjectInitializes this state object.- Overrides:
initializein classAbstractStateObject
-
isEquivalent
Description copied from interface:StateObjectDetermines 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
-
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 (DELETEorUPDATE).- Returns:
trueif an identification variable is not required;falseif 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:
trueif this identification variable was virtually created to fully qualify path expression;falseif it was parsed
-
setAs
public void setAs(boolean as) Sets whether theASidentifier is used or not.- Parameters:
as-trueif theASidentifier is part of the expression;falseotherwise
-
setExpression
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 a range variable declaration
-
setIdentificationVariable
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 (DELETEorUPDATE).- Parameters:
identificationVariableOptional-trueif an identification variable is not required;falseif it is required
-
setRootPath
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 theASidentifier. -
toTextInternal
Description copied from class:AbstractStateObjectPrints out a string representation of thisStateObject, which should not be used to define atruestring representation of a JPQL query but should be used for debugging purposes.- Specified by:
toTextInternalin classAbstractStateObject- Parameters:
writer- The writer used to print out the string representation- Throws:
IOException- This should never happens, it is only required becauseAppendableis used instead of any concrete class
-