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)
- Since:
- 2.4
- Version:
- 2.4
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
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
ModifierConstructorDescriptionprotected
Creates a newEncapsulatedIdentificationVariableExpressionStateObject
.protected
EncapsulatedIdentificationVariableExpressionStateObject
(StateObject parent, String identificationVariable) Creates a newEncapsulatedIdentificationVariableExpressionStateObject
. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Makes sure the cached identification variable and the one owned byIdentificationVariableStateObject
are the same.protected void
Clears the values related to the managed type and type.Returns the actual parsed object if thisStateObject
representation of the JPQL query was created by parsing an existing JPQL query.Returns the identification variable.Returns theIManagedType
associated with the field handled by this object.protected String
Returns the unique identifier of theJPQLQueryBNF
that will determine how to parse the encapsulated expression.Returns the encapsulatedStateObject
.getType()
Returns theIType
of the field handled by this object.Returns theITypeDeclaration
of the field handled by this object.boolean
Determines whether the identification variable has been defined or not.protected void
Initializes this state object.protected IManagedType
Retrieves theIManagedType
that is mapped to the identification variable, if and only if the identification variable is used to declare an entity.protected IType
Resolves theIType
of the property handled by this object.protected ITypeDeclaration
Resolves theITypeDeclaration
of the property handled by this object.void
setIdentificationVariable
(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 Details
-
IDENTIFICATION_VARIABLE_PROPERTY
Notifies the identification variable property has changed.- See Also:
-
-
Constructor Details
-
EncapsulatedIdentificationVariableExpressionStateObject
Creates a newEncapsulatedIdentificationVariableExpressionStateObject
.- Parameters:
parent
- The parent of this state object, which cannot benull
- Throws:
NullPointerException
- The given parent cannot benull
-
EncapsulatedIdentificationVariableExpressionStateObject
protected EncapsulatedIdentificationVariableExpressionStateObject(StateObject parent, String identificationVariable) Creates a newEncapsulatedIdentificationVariableExpressionStateObject
.- Parameters:
parent
- The parent of this state object, which cannot benull
identificationVariable
- The identification variable- Throws:
NullPointerException
- The given parent cannot benull
-
-
Method Details
-
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
Description copied from interface:StateObject
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
Returns the identification variable.- Returns:
- The name of the identification variable
-
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
Description copied from class:AbstractSingleEncapsulatedExpressionStateObject
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
Description copied from class:AbstractSingleEncapsulatedExpressionStateObject
Returns the encapsulatedStateObject
.- Overrides:
getStateObject
in classAbstractSingleEncapsulatedExpressionStateObject
- Returns:
- The encapsulated
StateObject
-
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
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()Description copied from class:AbstractStateObject
Initializes this state object.- Overrides:
initialize
in classAbstractStateObject
-
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
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
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
Sets the identification variable of this encapsulated expression.- Parameters:
identificationVariable
- The name of the identification variable
-