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
- Author:
- Pascal Filion
-
-
Field Summary
Fields Modifier and Type Field Description static String
AS_PROPERTY
Notifies the visibility of theAS
identifier has changed.static String
IDENTIFICATION_VARIABLE_PROPERTY
Notifies the identification variable property has changed.
-
Constructor Summary
Constructors Constructor Description AbstractRangeVariableDeclarationStateObject(AbstractIdentificationVariableDeclarationStateObject parent)
Creates a newRangeVariableDeclarationStateObject
.AbstractRangeVariableDeclarationStateObject(AbstractIdentificationVariableDeclarationStateObject parent, String root)
Creates a newRangeVariableDeclarationStateObject
.AbstractRangeVariableDeclarationStateObject(AbstractModifyClauseStateObject parent)
Creates a newAbstractRangeVariableDeclarationStateObject
.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description AbstractRangeVariableDeclarationStateObject
addAs()
Makes sure theAS
identifier is specified.RangeVariableDeclaration
getExpression()
Returns the actual parsed object if thisStateObject
representation of the JPQL query was created by parsing an existing JPQL query.String
getIdentificationVariable()
Returns the identification variable name that is ranging over the abstract schema type.IdentificationVariableStateObject
getIdentificationVariableStateObject()
Returns theIdentificationVariableStateObject
holding onto the identification variable.abstract String
getRootPath()
Returns the "root" object for objects which may not be reachable by navigation.StateObject
getRootStateObject()
Returns theStateObject
holding onto the abstract schema name.boolean
hasAs()
Determines whether theAS
identifier is used or not.boolean
hasIdentificationVariable()
Determines whether an identification variable was defined.ListIterable<IdentificationVariableStateObject>
identificationVariables()
Returns theIdentificationVariableStateObject
that are used by this state object.boolean
isEquivalent(StateObject stateObject)
Determines whether the givenStateObject
is equivalent to this one, i.e.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 theAS
identifier is used or not.void
setExpression(RangeVariableDeclaration 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" object.abstract void
setRootPath(String root)
Sets the "root" object for objects which may not be reachable by navigation.void
toggleAs()
Toggles the usage of theAS
identifier.-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
addPropertyChangeListener, children, decorate, equals, findIdentificationVariable, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getParent, getQueryBuilder, getRoot, getType, getType, getTypeHelper, getTypeRepository, hashCode, isDecorated, removePropertyChangeListener, setExpression, setParent, toString, toString, toText
-
Methods 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, toText
-
Methods inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.query.VariableDeclarationStateObject
getManagedType
-
-
-
-
Field Detail
-
AS_PROPERTY
public static final String AS_PROPERTY
Notifies the visibility of theAS
identifier has changed.- See Also:
- Constant Field Values
-
IDENTIFICATION_VARIABLE_PROPERTY
public static final 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 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
public AbstractRangeVariableDeclarationStateObject(AbstractModifyClauseStateObject parent)
Creates a newAbstractRangeVariableDeclarationStateObject
.- Parameters:
parent
- The parent of this state object, which cannot benull
- Throws:
NullPointerException
- The given parent cannot benull
-
-
Method Detail
-
addAs
public AbstractRangeVariableDeclarationStateObject addAs()
Makes sure theAS
identifier is specified.- Returns:
- This object
-
getExpression
public RangeVariableDeclaration 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 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 theIdentificationVariableStateObject
holding onto the identification variable.- Returns:
- The
IdentificationVariableStateObject
, which is nevernull
-
getRootPath
public abstract 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
holding onto the abstract schema name.- Returns:
- The
StateObject
, which is nevernull
-
hasAs
public boolean hasAs()
Determines whether theAS
identifier is used or not.- Returns:
true
if theAS
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 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
-
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
-
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
orUPDATE
).- 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 theAS
identifier is used or not.- Parameters:
as
-true
if theAS
identifier is part of the expression;false
otherwise
-
setExpression
public void setExpression(RangeVariableDeclaration 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 a range variable declaration
-
setIdentificationVariable
public void setIdentificationVariable(String identificationVariable)
Sets the new identification variable that will range over the "root" object.- Parameters:
identificationVariable
- The new identification variable
-
setRootPath
public abstract void setRootPath(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 theAS
identifier.
-
-