Class AbstractModifyClauseStateObject
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractModifyClauseStateObject
-
- All Implemented Interfaces:
DeclarationStateObject,StateObject
- Direct Known Subclasses:
DeleteClauseStateObject,UpdateClauseStateObject
public abstract class AbstractModifyClauseStateObject extends AbstractStateObject implements DeclarationStateObject
- Since:
- 2.4
- Version:
- 2.5
- Author:
- Pascal Filion
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ListIterable<VariableDeclarationStateObject>declarations()Returns the list of declarations declared in the declaration clause of the current query.IManagedTypefindManagedType(StateObject stateObject)Returns theIManagedTypefor the given identification variable.StringgetAbstractSchemaName()Returns the abstract schema name.AbstractSchemaNameStateObjectgetAbstractSchemaNameStateObject()Returns theAbstractSchemaNameStateObjectholding onto the abstract schema name.DeclarationStateObjectgetDeclaration()Returns the declaration clause which defines the domain of the query by declaring identification variables.IEntitygetEntity()Returns the actualIEntitythat has the abstract schema name.StringgetIdentificationVariable()Returns the identification variable name that is ranging over the abstract schema type.IdentificationVariableStateObjectgetIdentificationVariableStateObject()Returns theIdentificationVariableStateObjectholding onto the identification variable.abstract StringgetIdentifier()Returns the JPQL identifier of this clause.IManagedTypegetManagedType(StateObject stateObject)Returns theIManagedTypefor the given identification variable.AbstractModifyStatementStateObjectgetParent()Returns the parent of thisStateObject.RangeVariableDeclarationStateObjectgetRangeVariableDeclaration()Returns theStateObjectthat defines the range variable declaration.booleanhasIdentificationVariable()Determines whether an identification variable was defined.booleanisEquivalent(StateObject stateObject)Determines whether the givenStateObjectis equivalent to this one, i.e.voidsetDeclaration(String abstractSchemaName)Sets the abstract schema name to the given value and removes the identification variable.voidsetDeclaration(String abstractSchemaName, String identificationVariable)Sets the abstract schema name to the given value and the identification variable that will range over it.voidsetDeclaration(IEntity entity)Sets the abstract schema name to the given value.voidsetDeclaration(IEntity entity, String identificationVariable)Sets the abstract schema name to the given value and the identification variable that will range over it.voidsetEntity(IEntity entity)Sets the actualIEntityand updates the abstract schema name.voidsetEntityName(String entityName)Sets the name of the abstract schema, which is the name of the entity.voidsetIdentificationVariable(String identificationVariable)Sets the new identification variable that will range over the abstract schema name.-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
addPropertyChangeListener, children, decorate, equals, findIdentificationVariable, getDecorator, getExpression, getGrammar, getManagedTypeProvider, 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, getDecorator, getExpression, getGrammar, getManagedTypeProvider, getQueryBuilder, getRoot, isDecorated, removePropertyChangeListener, setParent, toString, toText
-
-
-
-
Method Detail
-
declarations
public ListIterable<VariableDeclarationStateObject> declarations()
Returns the list of declarations declared in the declaration clause of the current query.- Specified by:
declarationsin interfaceDeclarationStateObject- Returns:
- The list of
VariableDeclarationStateObjectthat define the domain of the query
-
findManagedType
public IManagedType findManagedType(StateObject stateObject)
Returns theIManagedTypefor the given identification variable. If the declaration is for a subquery and there is no managed type associated with the identification then the search will traverse up the query hierarchy.
In the above query, the managed type associated with the identification variable:SELECT e FROM Department d JOIN KEY(d.employees).addresses a- d is "Department"
- a is "Address"
- Specified by:
findManagedTypein interfaceDeclarationStateObject- Parameters:
stateObject- TheStateObjectthat should be an simple identification variable or an encapsulated identification variable with the identifierKEYorVALUE- Returns:
- The
IManagedTyperepresenting the domain object declared by the given identification variable - See Also:
DeclarationStateObject.getManagedType(StateObject)
-
getAbstractSchemaName
public String getAbstractSchemaName()
Returns the abstract schema name.- Returns:
- The name of the abstract schema type for which the identification variable is ranging over
-
getAbstractSchemaNameStateObject
public AbstractSchemaNameStateObject getAbstractSchemaNameStateObject()
Returns theAbstractSchemaNameStateObjectholding onto the abstract schema name.- Returns:
- The
AbstractSchemaNameStateObject, which is nevernull
-
getDeclaration
public DeclarationStateObject getDeclaration()
Returns the declaration clause which defines the domain of the query by declaring identification variables.- Specified by:
getDeclarationin interfaceStateObject- Overrides:
getDeclarationin classAbstractStateObject- Returns:
- The declaration clause of which this
StateObjectis a child; i.e. either the top-level declaration if this is part of the top query or the sub-level declaration if this is part of a subquery
-
getEntity
public IEntity getEntity()
Returns the actualIEntitythat has the abstract schema name.- Returns:
- The actual
IEntityornullif no entity exists
-
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 theIdentificationVariableStateObjectholding onto the identification variable.- Returns:
- The
IdentificationVariableStateObject, which is nevernull
-
getIdentifier
public abstract String getIdentifier()
Returns the JPQL identifier of this clause.- Returns:
- The JPQL identifier
-
getManagedType
public IManagedType getManagedType(StateObject stateObject)
Returns theIManagedTypefor the given identification variable. The search does not traverse up the query hierarchy if this declaration is for a subquery.
In the above query, the managed type associated with the identification variable:SELECT e FROM Department d JOIN KEY(d.employees).addresses a- d is "Department"
- a is "Address"
- Specified by:
getManagedTypein interfaceDeclarationStateObject- Parameters:
stateObject- TheStateObjectthat should be an simple identification variable or an encapsulated identification variable with the identifierKEYorVALUE- Returns:
- The
IManagedTyperepresenting the domain object declared by the given identification variable - See Also:
DeclarationStateObject.findManagedType(StateObject)
-
getParent
public AbstractModifyStatementStateObject getParent()
Returns the parent of thisStateObject.- Specified by:
getParentin interfaceStateObject- Overrides:
getParentin classAbstractStateObject- Returns:
- Returns the parent of this
StateObject, which isnullonly when this is the root of the hierarchy
-
getRangeVariableDeclaration
public RangeVariableDeclarationStateObject getRangeVariableDeclaration()
Returns theStateObjectthat defines the range variable declaration.- Returns:
- The
StateObjectthat defines the range variable declaration, which is nevernull
-
hasIdentificationVariable
public boolean hasIdentificationVariable()
Determines whether an identification variable was defined.- Returns:
trueif an identification variable is defined;falseotherwise
-
isEquivalent
public boolean isEquivalent(StateObject stateObject)
Determines 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
-
setDeclaration
public void setDeclaration(IEntity entity)
Sets the abstract schema name to the given value.- Parameters:
entity- TheIEntitythat this clause will range over
-
setDeclaration
public void setDeclaration(IEntity entity, String identificationVariable)
Sets the abstract schema name to the given value and the identification variable that will range over it.- Parameters:
entity- TheIEntitythat this clause will range overidentificationVariable- The new identification variable
-
setDeclaration
public void setDeclaration(String abstractSchemaName)
Sets the abstract schema name to the given value and removes the identification variable.- Parameters:
abstractSchemaName- The name of the abstract schema, which is the name of the entity
-
setDeclaration
public void setDeclaration(String abstractSchemaName, String identificationVariable)
Sets the abstract schema name to the given value and the identification variable that will range over it.- Parameters:
abstractSchemaName- The name of the abstract schema, which is the name of the entityidentificationVariable- The new identification variable
-
setEntity
public void setEntity(IEntity entity)
Sets the actualIEntityand updates the abstract schema name.- Parameters:
entity- TheIEntitythat this clause will range over
-
setEntityName
public void setEntityName(String entityName)
Sets the name of the abstract schema, which is the name of the entity.- Parameters:
entityName- The name of the entity
-
setIdentificationVariable
public void setIdentificationVariable(String identificationVariable)
Sets the new identification variable that will range over the abstract schema name.- Parameters:
identificationVariable- The new identification variable
-
-