Class IdentificationVariableStateObject
java.lang.Object
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleStateObject
org.eclipse.persistence.jpa.jpql.tools.model.query.IdentificationVariableStateObject
- All Implemented Interfaces:
StateObject
This state object represents a single identification variable, which is identifying TODO.
- Since:
- 2.4
- Version:
- 2.4
- See Also:
-
Field Summary
FieldsFields inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleStateObject
TEXT_PROPERTY -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newIdentificationVariableStateObject.IdentificationVariableStateObject(StateObject parent, String variable) Creates a newIdentificationVariableStateObject. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(StateObjectVisitor visitor) Visits thisStateObjectby the givenvisitor.protected voidaddProblems(List<Problem> problems) Adds to the given list the problems that were found with the current state of thisStateObject, which means there are validation issues.protected voidcheckIntegrity(String text) Makes sure the current identification variable and the given one are the same.protected voidClears the values related to the managed type and type.Returns the actual parsed object if thisStateObjectrepresentation of the JPQL query was created by parsing an existing JPQL query.Returns theIManagedTypeassociated with the field handled by this object.ReturnsgetType()Returns theITypeof the field handled by this object.Returns theITypeDeclarationof the field handled by this object.booleanisEquivalent(StateObject stateObject) Determines whether the givenStateObjectis equivalent to this one, i.e.booleanDetermines whether this identification variable is virtual, meaning it's not part of the query but is required for proper navigability.protected IManagedTypeRetrieves theIManagedTypethat is mapped to the identification variable, if and only if the identification variable is used to declare an entity.protected IMappingResolvesprotected ITypeResolves theITypeof the property handled by this object.protected ITypeDeclarationResolves theITypeDeclarationof the property handled by this object.voidsetExpression(IdentificationVariable expression) Keeps a reference of theparsed objectobject, which should only be done when this object is instantiated during the conversion of a parsed JPQL query intoStateObjects.voidSets the text held by this state object.voidsetVirtual(boolean virtual) Sets whether this identification variable is virtual, meaning it's not part of the query but is required for proper navigability.protected voidtoTextInternal(Appendable writer) Prints out a string representation of thisStateObject, which should not be used to define atruestring representation of a JPQL query but should be used for debugging purposes.Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleStateObject
getText, hasText, setTextInternallyMethods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
acceptUnknownVisitor, acceptUnknownVisitor, addChildren, 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, initialize, isDecorated, parent, parent, parent, removePropertyChangeListener, setExpression, setParent, toString, toString, toStringInternal, toStringItems, toText
-
Field Details
-
DEFINED_PROPERTY
Notify a change in the defined property.- See Also:
-
-
Constructor Details
-
IdentificationVariableStateObject
Creates a newIdentificationVariableStateObject.- Parameters:
parent- The parent of this state object, which cannot benull- Throws:
NullPointerException- The given parent cannot benull
-
IdentificationVariableStateObject
Creates a newIdentificationVariableStateObject.- Parameters:
parent- The parent of this state object, which cannot benullvariable- The name of the identification variable- Throws:
NullPointerException- The given parent cannot benull
-
-
Method Details
-
accept
Description copied from interface:StateObjectVisits thisStateObjectby the givenvisitor.- Parameters:
visitor- Thevisitorto visit this object
-
addProblems
Description copied from class:AbstractStateObjectAdds to the given list the problems that were found with the current state of thisStateObject, which means there are validation issues.- Overrides:
addProblemsin classAbstractStateObject- Parameters:
problems- The list to which the problems are added
-
checkIntegrity
Makes sure the current identification variable and the given one are the same. If they are not, then clears the cached values related to the type.- Parameters:
text- The new identification variable
-
clearResolvedObjects
protected void clearResolvedObjects()Clears the values related to the managed type and type. -
getExpression
Description copied from interface:StateObjectReturns the actual parsed object if thisStateObjectrepresentation of the JPQL query was created by parsing an existing JPQL query.- Specified by:
getExpressionin interfaceStateObject- Overrides:
getExpressionin classAbstractStateObject- 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)
-
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
-
getMapping
Returns -
getType
Returns theITypeof the field handled by this object.- Returns:
- Either the
ITypethat was resolved by this state object or theITypeforIType.UNRESOLVABLE_TYPEif it could not be resolved
-
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
-
isEquivalent
Description copied from interface:StateObjectDetermines whether the givenStateObjectis equivalent to this one, i.e. the information of bothStateObjectis the same.- Specified by:
isEquivalentin interfaceStateObject- Overrides:
isEquivalentin classSimpleStateObject- Parameters:
stateObject- TheStateObjectto compare its content to this one- Returns:
trueif both object are equivalent;falseotherwise
-
isVirtual
public boolean isVirtual()Determines whether this identification variable is virtual, meaning it's not part of the query but is required for proper navigability.- Returns:
trueif this identification variable was virtually created to fully qualify path expression;falseif it was parsed
-
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
-
resolveMapping
Resolves -
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
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
-
setExpression
Keeps a reference of theparsed objectobject, which should only be done when this object is instantiated during the conversion of a parsed JPQL query intoStateObjects.- Parameters:
expression- Theparsed objectrepresenting an identification variable
-
setText
Description copied from class:SimpleStateObjectSets the text held by this state object.- Overrides:
setTextin classSimpleStateObject- Parameters:
text- This model's text value
-
setVirtual
public void setVirtual(boolean virtual) Sets whether this identification variable is virtual, meaning it's not part of the query but is required for proper navigability.- Parameters:
virtual-trueif this identification variable was virtually created to fully qualify path expression;falseif it was parsed
-
toTextInternal
Description copied from class:AbstractStateObjectPrints out a string representation of thisStateObject, which should not be used to define atruestring representation of a JPQL query but should be used for debugging purposes.- Overrides:
toTextInternalin classSimpleStateObject- Parameters:
writer- The writer used to print out the string representation- Throws:
IOException- This should never happens, it is only required becauseAppendableis used instead of any concrete class
-