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
public class IdentificationVariableStateObject extends SimpleStateObject
This state object represents a single identification variable, which is identifying TODO.- Since:
- 2.4
- Version:
- 2.4
- Author:
- Pascal Filion
- See Also:
IdentificationVariable
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFINED_PROPERTY
Notify a change in the defined property.-
Fields inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleStateObject
TEXT_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description IdentificationVariableStateObject(StateObject parent)
Creates a newIdentificationVariableStateObject
.IdentificationVariableStateObject(StateObject parent, String variable)
Creates a newIdentificationVariableStateObject
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(StateObjectVisitor visitor)
Visits thisStateObject
by the givenvisitor
.IdentificationVariable
getExpression()
Returns the actual parsed object if thisStateObject
representation of the JPQL query was created by parsing an existing JPQL query.IManagedType
getManagedType()
Returns theIManagedType
associated with the field handled by this object.IMapping
getMapping()
ReturnsIType
getType()
Returns theIType
of the field handled by this object.ITypeDeclaration
getTypeDeclaration()
Returns theITypeDeclaration
of the field handled by this object.boolean
isEquivalent(StateObject stateObject)
Determines whether the givenStateObject
is equivalent to this one, i.e.boolean
isVirtual()
Determines whether this identification variable is virtual, meaning it's not part of the query but is required for proper navigability.void
setExpression(IdentificationVariable expression)
Keeps a reference of theparsed object
object, which should only be done when this object is instantiated during the conversion of a parsed JPQL query intoStateObjects
.void
setText(String text)
Sets the text held by this state object.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.-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleStateObject
getText, hasText
-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
addPropertyChangeListener, children, decorate, equals, findIdentificationVariable, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getParent, getQueryBuilder, getRoot, getType, getType, getTypeHelper, getTypeRepository, hashCode, isDecorated, removePropertyChangeListener, setExpression, setParent, toString, toString, toText
-
-
-
-
Field Detail
-
DEFINED_PROPERTY
public static final String DEFINED_PROPERTY
Notify a change in the defined property.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
IdentificationVariableStateObject
public IdentificationVariableStateObject(StateObject parent)
Creates a newIdentificationVariableStateObject
.- Parameters:
parent
- The parent of this state object, which cannot benull
- Throws:
NullPointerException
- The given parent cannot benull
-
IdentificationVariableStateObject
public IdentificationVariableStateObject(StateObject parent, String variable)
Creates a newIdentificationVariableStateObject
.- Parameters:
parent
- The parent of this state object, which cannot benull
variable
- The name of the identification variable- Throws:
NullPointerException
- The given parent cannot benull
-
-
Method Detail
-
accept
public void accept(StateObjectVisitor visitor)
Visits thisStateObject
by the givenvisitor
.- Parameters:
visitor
- Thevisitor
to visit this object
-
getExpression
public IdentificationVariable 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 classAbstractStateObject
- 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)
-
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
-
getMapping
public IMapping getMapping()
Returns- Returns:
-
getType
public IType getType()
Returns theIType
of the field handled by this object.- Returns:
- Either the
IType
that was resolved by this state object 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
-
isEquivalent
public boolean isEquivalent(StateObject stateObject)
Determines whether the givenStateObject
is equivalent to this one, i.e. the information of bothStateObject
is the same.- Specified by:
isEquivalent
in interfaceStateObject
- Overrides:
isEquivalent
in classSimpleStateObject
- Parameters:
stateObject
- TheStateObject
to compare its content to this one- Returns:
true
if both object are equivalent;false
otherwise
-
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:
true
if this identification variable was virtually created to fully qualify path expression;false
if it was parsed
-
setExpression
public void setExpression(IdentificationVariable expression)
Keeps a reference of theparsed object
object, which should only be done when this object is instantiated during the conversion of a parsed JPQL query intoStateObjects
.- Parameters:
expression
- Theparsed object
representing an identification variable
-
setText
public void setText(String text)
Sets the text held by this state object.- Overrides:
setText
in 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
-true
if this identification variable was virtually created to fully qualify path expression;false
if it was parsed
-
-