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.String
IDENTIFICATION_VARIABLE_PROPERTY
Notifies 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 protected
EncapsulatedIdentificationVariableExpressionStateObject(StateObject parent)
Creates a newEncapsulatedIdentificationVariableExpressionStateObject
.protected
EncapsulatedIdentificationVariableExpressionStateObject(StateObject parent, java.lang.String identificationVariable)
Creates a newEncapsulatedIdentificationVariableExpressionStateObject
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkIntegrity()
Makes sure the cached identification variable and the one owned byIdentificationVariableStateObject
are the same.protected void
clearResolvedObjects()
Clears the values related to the managed type and type.EncapsulatedIdentificationVariableExpression
getExpression()
Returns the actual parsed object if thisStateObject
representation of the JPQL query was created by parsing an existing JPQL query.java.lang.String
getIdentificationVariable()
Returns the identification variable.IManagedType
getManagedType()
Returns theIManagedType
associated with the field handled by this object.protected java.lang.String
getQueryBNFId()
Returns the unique identifier of theJPQLQueryBNF
that will determine how to parse the encapsulated expression.IdentificationVariableStateObject
getStateObject()
Returns the encapsulatedStateObject
.IType
getType()
Returns theIType
of the field handled by this object.ITypeDeclaration
getTypeDeclaration()
Returns theITypeDeclaration
of the field handled by this object.boolean
hasIdentificationVariable()
Determines whether the identification variable has been defined or not.protected void
initialize()
Initializes this state object.protected IManagedType
resolveManagedType()
Retrieves theIManagedType
that is mapped to the identification variable, if and only if the identification variable is used to declare an entity.protected IType
resolveType()
Resolves theIType
of the property handled by this object.protected ITypeDeclaration
resolveTypeDeclaration()
Resolves theITypeDeclaration
of the property handled by this object.void
setIdentificationVariable(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 benull
identificationVariable
- 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 byIdentificationVariableStateObject
are 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 thisStateObject
representation of the JPQL query was created by parsing an existing JPQL query.- Specified by:
getExpression
in interfaceStateObject
- Overrides:
getExpression
in classAbstractSingleEncapsulatedExpressionStateObject
- 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 java.lang.String getIdentificationVariable()
Returns the identification variable.- Returns:
- The name of the identification variable
-
getManagedType
public IManagedType getManagedType()
Returns theIManagedType
associated with the field handled by this object. If this object does not handle a field that has aIManagedType
, thennull
should be returned.For example: "
SELECT e FROM Employee e
", the object for e would be returning theIManagedType
for Employee.- Returns:
- Either the
IManagedType
, if it could be resolved;null
otherwise
-
getQueryBNFId
protected java.lang.String getQueryBNFId()
Returns the unique identifier of theJPQLQueryBNF
that will determine how to parse the encapsulated expression.- Specified by:
getQueryBNFId
in classAbstractSingleEncapsulatedExpressionStateObject
- Returns:
- The non-
null
ID of the BNF
-
getStateObject
public IdentificationVariableStateObject getStateObject()
Returns the encapsulatedStateObject
.- Overrides:
getStateObject
in classAbstractSingleEncapsulatedExpressionStateObject
- Returns:
- The encapsulated
StateObject
-
getType
public IType getType()
Returns theIType
of the field handled by this object.- Returns:
- Either the
IType
of the identification variable or theIType
forIType.UNRESOLVABLE_TYPE
if it could not be resolved
-
getTypeDeclaration
public ITypeDeclaration getTypeDeclaration()
Returns theITypeDeclaration
of the field handled by this object.- Returns:
- Either the
ITypeDeclaration
that was resolved by this object or theITypeDeclaration
forIType.UNRESOLVABLE_TYPE
if it could not be resolved
-
hasIdentificationVariable
public boolean hasIdentificationVariable()
Determines whether the identification variable has been defined or not.- Returns:
true
if the identification variable has been defined;false
otherwise
-
initialize
protected void initialize()
Initializes this state object.- Overrides:
initialize
in classAbstractStateObject
-
resolveManagedType
protected IManagedType resolveManagedType()
Retrieves theIManagedType
that is mapped to the identification variable, if and only if the identification variable is used to declare an entity.- Returns:
- Either the
IManagedType
declared by the identification variable ornull
if it could not be resolved
-
resolveType
protected IType resolveType()
Resolves theIType
of the property handled by this object.- Returns:
- Either the
IType
that was resolved by this object or theIType
forIType.UNRESOLVABLE_TYPE
if it could not be resolved
-
resolveTypeDeclaration
protected ITypeDeclaration resolveTypeDeclaration()
Resolves theITypeDeclaration
of the property handled by this object.- Returns:
- Either the
ITypeDeclaration
that was resolved by this object or theITypeDeclaration
forIType.UNRESOLVABLE_TYPE
if 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
-
-