Class EncapsulatedIdentificationVariableExpressionStateObject
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractEncapsulatedExpressionStateObject
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.EncapsulatedIdentificationVariableExpressionStateObject
-
- All Implemented Interfaces:
StateObject
- Direct Known Subclasses:
EntryExpressionStateObject,IndexExpressionStateObject,KeyExpressionStateObject,ObjectExpressionStateObject,ValueExpressionStateObject
public abstract class EncapsulatedIdentificationVariableExpressionStateObject extends AbstractSingleEncapsulatedExpressionStateObject
This object represents an identification variable that is wrapped by a function.BNF:<identifier>(identification_variable)- Version:
- 2.4
- See Also:
EncapsulatedIdentificationVariableExpression- Author:
- Pascal Filion
- Since:
- 2.4
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringIDENTIFICATION_VARIABLE_PROPERTYNotifies the identification variable property has changed.-
Fields inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject
STATE_OBJECT_PROPERTY
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedEncapsulatedIdentificationVariableExpressionStateObject(StateObject parent)Creates a newEncapsulatedIdentificationVariableExpressionStateObject.protectedEncapsulatedIdentificationVariableExpressionStateObject(StateObject parent, java.lang.String identificationVariable)Creates a newEncapsulatedIdentificationVariableExpressionStateObject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckIntegrity()Makes sure the cached identification variable and the one owned byIdentificationVariableStateObjectare the same.protected voidclearResolvedObjects()Clears the values related to the managed type and type.EncapsulatedIdentificationVariableExpressiongetExpression()Returns the actual parsed object if thisStateObjectrepresentation of the JPQL query was created by parsing an existing JPQL query.java.lang.StringgetIdentificationVariable()Returns the identification variable.IManagedTypegetManagedType()Returns theIManagedTypeassociated with the field handled by this object.protected java.lang.StringgetQueryBNFId()Returns the unique identifier of theJPQLQueryBNFthat will determine how to parse the encapsulated expression.IdentificationVariableStateObjectgetStateObject()Returns the encapsulatedStateObject.ITypegetType()Returns theITypeof the field handled by this object.ITypeDeclarationgetTypeDeclaration()Returns theITypeDeclarationof the field handled by this object.booleanhasIdentificationVariable()Determines whether the identification variable has been defined or not.protected voidinitialize()Initializes this state object.protected IManagedTyperesolveManagedType()Retrieves theIManagedTypethat is mapped to the identification variable, if and only if the identification variable is used to declare an entity.protected ITyperesolveType()Resolves theITypeof the property handled by this object.protected ITypeDeclarationresolveTypeDeclaration()Resolves theITypeDeclarationof the property handled by this object.voidsetIdentificationVariable(java.lang.String identificationVariable)Sets the identification variable of this encapsulated expression.-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject
addChildren, hasStateObject, isEquivalent, parse, setStateObject, toTextEncapsulatedExpression
-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractEncapsulatedExpressionStateObject
getIdentifier, toTextInternal
-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
acceptUnknownVisitor, acceptUnknownVisitor, addProblems, 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.tools.model.query.StateObject
accept
-
-
-
-
Field Detail
-
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
-
EncapsulatedIdentificationVariableExpressionStateObject
protected EncapsulatedIdentificationVariableExpressionStateObject(StateObject parent)
Creates a newEncapsulatedIdentificationVariableExpressionStateObject.- Parameters:
parent- The parent of this state object, which cannot benull- Throws:
java.lang.NullPointerException- The given parent cannot benull
-
EncapsulatedIdentificationVariableExpressionStateObject
protected EncapsulatedIdentificationVariableExpressionStateObject(StateObject parent, java.lang.String identificationVariable)
Creates a newEncapsulatedIdentificationVariableExpressionStateObject.- Parameters:
parent- The parent of this state object, which cannot benullidentificationVariable- The identification variable- Throws:
java.lang.NullPointerException- The given parent cannot benull
-
-
Method Detail
-
checkIntegrity
protected void checkIntegrity()
Makes sure the cached identification variable and the one owned byIdentificationVariableStateObjectare the same. If they are not, then clears the cached values related to the type.
-
clearResolvedObjects
protected void clearResolvedObjects()
Clears the values related to the managed type and type.
-
getExpression
public EncapsulatedIdentificationVariableExpression getExpression()
Returns the actual parsed object if thisStateObjectrepresentation of the JPQL query was created by parsing an existing JPQL query.- Specified by:
getExpressionin interfaceStateObject- Overrides:
getExpressionin classAbstractSingleEncapsulatedExpressionStateObject- 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
public java.lang.String getIdentificationVariable()
Returns the identification variable.- Returns:
- The name of the identification variable
-
getManagedType
public IManagedType getManagedType()
Returns theIManagedTypeassociated with the field handled by this object. If this object does not handle a field that has aIManagedType, thennullshould be returned.For example: "
SELECT e FROM Employee e", the object for e would be returning theIManagedTypefor Employee.- Returns:
- Either the
IManagedType, if it could be resolved;nullotherwise
-
getQueryBNFId
protected java.lang.String getQueryBNFId()
Returns the unique identifier of theJPQLQueryBNFthat will determine how to parse the encapsulated expression.- Specified by:
getQueryBNFIdin classAbstractSingleEncapsulatedExpressionStateObject- Returns:
- The non-
nullID of the BNF
-
getStateObject
public IdentificationVariableStateObject getStateObject()
Returns the encapsulatedStateObject.- Overrides:
getStateObjectin classAbstractSingleEncapsulatedExpressionStateObject- Returns:
- The encapsulated
StateObject
-
getType
public IType getType()
Returns theITypeof the field handled by this object.- Returns:
- Either the
ITypeof the identification variable or theITypeforIType.UNRESOLVABLE_TYPEif it could not be resolved
-
getTypeDeclaration
public ITypeDeclaration getTypeDeclaration()
Returns theITypeDeclarationof the field handled by this object.- Returns:
- Either the
ITypeDeclarationthat was resolved by this object or theITypeDeclarationforIType.UNRESOLVABLE_TYPEif it could not be resolved
-
hasIdentificationVariable
public boolean hasIdentificationVariable()
Determines whether the identification variable has been defined or not.- Returns:
trueif the identification variable has been defined;falseotherwise
-
initialize
protected void initialize()
Initializes this state object.- Overrides:
initializein classAbstractStateObject
-
resolveManagedType
protected IManagedType resolveManagedType()
Retrieves theIManagedTypethat is mapped to the identification variable, if and only if the identification variable is used to declare an entity.- Returns:
- Either the
IManagedTypedeclared by the identification variable ornullif it could not be resolved
-
resolveType
protected IType resolveType()
Resolves theITypeof the property handled by this object.- Returns:
- Either the
ITypethat was resolved by this object or theITypeforIType.UNRESOLVABLE_TYPEif it could not be resolved
-
resolveTypeDeclaration
protected ITypeDeclaration resolveTypeDeclaration()
Resolves theITypeDeclarationof the property handled by this object.- Returns:
- Either the
ITypeDeclarationthat was resolved by this object or theITypeDeclarationforIType.UNRESOLVABLE_TYPEif it could not be resolved
-
setIdentificationVariable
public void setIdentificationVariable(java.lang.String identificationVariable)
Sets the identification variable of this encapsulated expression.- Parameters:
identificationVariable- The name of the identification variable
-
-