public class TreatExpressionStateObject extends AbstractStateObject
Note: EclipseLinkStateObjectVisitor
needs to be used to traverse this state object.
join_treat ::= TREAT(collection_valued_path_expression [AS] entity_type_literal)
TreatExpression
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AS_PROPERTY
Notifies the visibility of the
AS identifier has changed. |
static java.lang.String |
ENTITY_TYPE_NAME_PROPERTY
Notifies the entity type name property has changed.
|
Constructor and Description |
---|
TreatExpressionStateObject(JoinStateObject parent)
Creates a new
TreatExpressionStateObject . |
TreatExpressionStateObject(JoinStateObject parent,
boolean as,
java.lang.String entityTypeName)
Creates a new
TreatExpressionStateObject . |
TreatExpressionStateObject(JoinStateObject parent,
java.lang.String entityTypeName)
Creates a new
TreatExpressionStateObject . |
Modifier and Type | Method and Description |
---|---|
void |
accept(StateObjectVisitor visitor)
Visits this
StateObject by the given visitor . |
TreatExpressionStateObject |
addAs()
Makes sure the
AS identifier is specified. |
protected void |
addChildren(java.util.List<StateObject> children)
Adds the children of this
StateObject to the given list. |
void |
appendToEntityTypeName(java.lang.String text)
Appends the given text to the existing entity type name property.
|
IEntity |
getEntity()
Resolves the entity type name to the external form of the actual
IEntity . |
java.lang.String |
getEntityTypeName()
Returns the name of the entity that is used to downcast the join association path.
|
TreatExpression |
getExpression()
Returns the actual parsed object if this
StateObject representation of the JPQL query
was created by parsing an existing JPQL query. |
JoinStateObject |
getJoin()
Returns the reference of the
JoinStateObject . |
StateObject |
getJoinAssociationIdentificationVariable()
Returns the
StateObject representing the identification variable that starts the path
expression, which can be a sample identification variable, a map value, map key or map entry
expression. |
CollectionValuedPathExpressionStateObject |
getJoinAssociationPathStateObject()
Returns the
CollectionValuedPathExpressionStateObject representing the join
association path. |
boolean |
hasAs()
Determines whether the
AS identifier is used. |
boolean |
hasEntityTypeName()
Determines whether the.
|
protected void |
initialize()
Initializes this state object.
|
boolean |
isEquivalent(StateObject stateObject)
Determines whether the given
StateObject is equivalent to this one, i.e. the
information of both StateObject is the same. |
void |
removeAs()
Makes sure the
AS identifier is not specified. |
void |
setAs(boolean as)
Sets whether the
AS identifier should be used. |
void |
setEntityTypeName(java.lang.Class<?> entityType)
Sets the name of the entity that is used to downcast the join association path.
|
void |
setEntityTypeName(IEntity entityType)
Sets the name of the entity that is used to downcast the join association path.
|
void |
setEntityTypeName(java.lang.String entityTypeName)
Sets the name of the entity that is used to downcast the join association path.
|
void |
setExpression(TreatExpression expression)
Keeps a reference of the
parsed object object, which should only be
done when this object is instantiated during the conversion of a parsed JPQL query into
StateObjects . |
void |
toggleAs()
Toggles the visibility of the
AS identifier; either adds it if it's not
present otherwise removes it if it's present. |
protected void |
toTextInternal(java.lang.Appendable writer)
Prints out a string representation of this
StateObject , which should not be used to
define a true string representation of a JPQL query but should be used for
debugging purposes. |
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
public static final java.lang.String AS_PROPERTY
AS
identifier has changed.public static final java.lang.String ENTITY_TYPE_NAME_PROPERTY
public TreatExpressionStateObject(JoinStateObject parent)
TreatExpressionStateObject
.parent
- The parent of this state object, which is temporary since this state object will
be parented with the state object representing the join's association path expressionpublic TreatExpressionStateObject(JoinStateObject parent, boolean as, java.lang.String entityTypeName)
TreatExpressionStateObject
.parent
- The parent of this state object, which is temporary since this state object will
be parented with the state object representing the join's association path expressionas
- Determines whether the AS
identifier is used or notentityTypeName
- The entity type name used to cast the base expressionpublic TreatExpressionStateObject(JoinStateObject parent, java.lang.String entityTypeName)
TreatExpressionStateObject
.parent
- The parent of this state object, which is temporary since this state object will
be parented with the state object representing the join's association path expressionentityTypeName
- The entity type name used to cast the base expressionpublic void accept(StateObjectVisitor visitor)
StateObject
by the given visitor
.visitor
- The visitor
to visit this objectpublic TreatExpressionStateObject addAs()
AS
identifier is specified.protected void addChildren(java.util.List<StateObject> children)
StateObject
to the given list.addChildren
in class AbstractStateObject
children
- The list used to store the childrenpublic void appendToEntityTypeName(java.lang.String text)
text
- The text to append to the entity type name property or nothing is done if the
given value is null
public IEntity getEntity()
IEntity
.IEntity
with the same entity type name or null
if the
managed type provider does not have an entity with that namepublic java.lang.String getEntityTypeName()
public TreatExpression getExpression()
StateObject
representation of the JPQL query
was created by parsing an existing JPQL query.getExpression
in interface StateObject
getExpression
in class AbstractStateObject
StateObject
or null
when the JPQL query is manually created (i.e. not from a string)public JoinStateObject getJoin()
JoinStateObject
.public StateObject getJoinAssociationIdentificationVariable()
StateObject
representing the identification variable that starts the path
expression, which can be a sample identification variable, a map value, map key or map entry
expression.public CollectionValuedPathExpressionStateObject getJoinAssociationPathStateObject()
CollectionValuedPathExpressionStateObject
representing the join
association path.public boolean hasAs()
AS
identifier is used.true
if the AS
identifier is used; false
otherwisepublic boolean hasEntityTypeName()
true
if the entity type name has been defined; false
otherwiseprotected void initialize()
initialize
in class AbstractStateObject
public boolean isEquivalent(StateObject stateObject)
StateObject
is equivalent to this one, i.e. the
information of both StateObject
is the same.isEquivalent
in interface StateObject
isEquivalent
in class AbstractStateObject
stateObject
- The StateObject
to compare its content to this onetrue
if both object are equivalent; false
otherwisepublic void removeAs()
AS
identifier is not specified.public void setAs(boolean as)
AS
identifier should be used.as
- true
if the AS
identifier should be used part;
false
otherwisepublic void setEntityTypeName(java.lang.Class<?> entityType)
entityType
- The Java class representing the entity typepublic void setEntityTypeName(IEntity entityType)
entityType
- The external form of the entity typepublic void setEntityTypeName(java.lang.String entityTypeName)
entityTypeName
- The new name of the entity used for down castingpublic void setExpression(TreatExpression expression)
parsed object
object, which should only be
done when this object is instantiated during the conversion of a parsed JPQL query into
StateObjects
.expression
- The parsed object
representing the TREAD
expressionpublic void toggleAs()
AS
identifier; either adds it if it's not
present otherwise removes it if it's present.protected void toTextInternal(java.lang.Appendable writer) throws java.io.IOException
StateObject
, which should not be used to
define a true
string representation of a JPQL query but should be used for
debugging purposes.toTextInternal
in class AbstractStateObject
writer
- The writer used to print out the string representationjava.io.IOException
- This should never happens, it is only required because Appendable
is used instead of any concrete class