public abstract class AbstractFromClauseStateObject extends AbstractListHolderStateObject<VariableDeclarationStateObject> implements DeclarationStateObject
FROM
clause, which
is either the FROM
clause of the query or of a sub-query expression.AbstractSelectStatementStateObject
,
FromClauseStateObject
,
AbstractFromClause
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
VARIABLE_DECLARATIONS_LIST
Notifies the content of the list of
VariableDeclarationStateObject has changed. |
Modifier | Constructor and Description |
---|---|
protected |
AbstractFromClauseStateObject(AbstractSelectStatementStateObject parent)
Creates a new
AbstractFromClauseStateObject . |
Modifier and Type | Method and Description |
---|---|
CollectionMemberDeclarationStateObject |
addCollectionDeclaration()
Adds a new collection declaration to the
FROM clause. |
CollectionMemberDeclarationStateObject |
addCollectionDeclaration(java.lang.String collectionValuedPath,
java.lang.String identificationVariable)
Adds a new collection declaration to the
FROM clause. |
protected void |
addProblems(java.util.List<Problem> currentProblems)
Adds to the given list the problems that were found with the current state of this
StateObject , which means there are validation issues. |
IdentificationVariableDeclarationStateObject |
addRangeDeclaration()
Adds a new range variable declaration to the
FROM clause. |
IdentificationVariableDeclarationStateObject |
addRangeDeclaration(IEntity entity,
java.lang.String identificationVariable)
Adds to this select statement a new range variable declaration.
|
IdentificationVariableDeclarationStateObject |
addRangeDeclaration(java.lang.String entityName,
java.lang.String identificationVariable)
Adds a new range variable declaration.
|
protected abstract java.lang.String |
declarationBNF()
Returns the BNF of the declaration part of this clause.
|
ListIterable<? extends VariableDeclarationStateObject> |
declarations()
Returns the list of declarations declared in the declaration clause of the current query.
|
IdentificationVariableStateObject |
findIdentificationVariable(java.lang.String variable)
Returns the
IdentificationVariableStateObject representing the given identification
variable. |
DeclarationStateObject |
getDeclaration()
Returns the declaration clause which defines the domain of the query by declaring
identification variables.
|
AbstractFromClause |
getExpression()
Returns the actual parsed object if this
StateObject representation of the JPQL query
was created by parsing an existing JPQL query. |
IManagedType |
getManagedType(StateObject stateObject)
Returns the
IManagedType for the given identification variable. |
AbstractSelectStatementStateObject |
getParent()
Returns the parent of this
StateObject . |
java.lang.Iterable<IdentificationVariableStateObject> |
identificationVariables()
Returns the
IdentificationVariableStateObjects
holding onto the identification variables, which are the variables defined in the
FROM clause. |
boolean |
isEquivalent(StateObject stateObject)
Determines whether the given
StateObject is equivalent to this one, i.e. the
information of both StateObject is the same. |
protected java.lang.String |
listName()
Returns the name that is uniquely identifying the list.
|
void |
parse(java.lang.String jpqlFragment)
Parses the given JPQL fragment and create the select item.
|
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. |
addChildren, addItem, addItems, addListChangeListener, areChildrenEquivalent, canMoveDown, canMoveUp, getItem, hasItems, initialize, items, itemsSize, moveDown, moveUp, removeItem, removeItems, removeListChangeListener, toStringItems
acceptUnknownVisitor, acceptUnknownVisitor, addPropertyChangeListener, areEquivalent, buildProblem, buildProblem, buildStateObject, buildStateObjects, checkParent, children, decorate, equals, firePropertyChanged, getChangeSupport, getDecorator, getGrammar, getManagedTypeProvider, getQueryBuilder, getRoot, getType, getType, getTypeHelper, getTypeRepository, hashCode, isDecorated, parent, parent, parent, removePropertyChangeListener, setExpression, setParent, toString, toString, toStringInternal, toStringItems, toText
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
findManagedType
accept, addPropertyChangeListener, children, decorate, getDecorator, getGrammar, getManagedTypeProvider, getQueryBuilder, getRoot, isDecorated, removePropertyChangeListener, setParent, toString, toText
public static final java.lang.String VARIABLE_DECLARATIONS_LIST
VariableDeclarationStateObject
has changed.protected AbstractFromClauseStateObject(AbstractSelectStatementStateObject parent)
AbstractFromClauseStateObject
.parent
- The parent of this state object, which cannot be null
java.lang.NullPointerException
- The given parent cannot be null
public CollectionMemberDeclarationStateObject addCollectionDeclaration()
FROM
clause.CollectionMemberDeclarationStateObject
representing the collection declarationpublic CollectionMemberDeclarationStateObject addCollectionDeclaration(java.lang.String collectionValuedPath, java.lang.String identificationVariable)
FROM
clause.collectionValuedPath
- The collection-valued path expressionidentificationVariable
- The variable defining the collection-valued path expressionCollectionMemberDeclarationStateObject
representing the collection
declarationprotected void addProblems(java.util.List<Problem> currentProblems)
StateObject
, which means there are validation issues.addProblems
in class AbstractStateObject
currentProblems
- The list to which the problems are addedpublic IdentificationVariableDeclarationStateObject addRangeDeclaration()
FROM
clause.StateObject
representing the range variable declarationpublic IdentificationVariableDeclarationStateObject addRangeDeclaration(IEntity entity, java.lang.String identificationVariable)
entity
- The external form of the entity to add to the declaration listidentificationVariable
- The unique identifier identifying the abstract schema namepublic IdentificationVariableDeclarationStateObject addRangeDeclaration(java.lang.String entityName, java.lang.String identificationVariable)
entityName
- The name of the entity nameidentificationVariable
- The new identification variableprotected abstract java.lang.String declarationBNF()
public ListIterable<? extends VariableDeclarationStateObject> declarations()
declarations
in interface DeclarationStateObject
VariableDeclarationStateObject
that define the domain of the querypublic IdentificationVariableStateObject findIdentificationVariable(java.lang.String variable)
IdentificationVariableStateObject
representing the given identification
variable.findIdentificationVariable
in interface StateObject
findIdentificationVariable
in class AbstractStateObject
variable
- The name of the identification variable to retrieve its state objectIdentificationVariableStateObject
defining the given identification variablepublic DeclarationStateObject getDeclaration()
getDeclaration
in interface StateObject
getDeclaration
in class AbstractStateObject
StateObject
is a child; i.e. either the
top-level declaration if this is part of the top query or the sub-level declaration if this is
part of a subquerypublic AbstractFromClause 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 IManagedType getManagedType(StateObject stateObject)
IManagedType
for the given identification variable. The search does not
traverse up the query hierarchy if this declaration is for a subquery.
SELECT e FROM Department d JOIN KEY(d.employees).addresses a
In the above query, the managed type associated with the identification variable:
getManagedType
in interface DeclarationStateObject
stateObject
- The StateObject
that should be an simple identification variable or
an encapsulated identification variable with the identifier KEY
or
VALUE
IManagedType
representing the domain object declared by the given
identification variableDeclarationStateObject.findManagedType(StateObject)
public AbstractSelectStatementStateObject getParent()
StateObject
.getParent
in interface StateObject
getParent
in class AbstractStateObject
StateObject
, which is null
only when
this is the root of the hierarchypublic java.lang.Iterable<IdentificationVariableStateObject> identificationVariables()
IdentificationVariableStateObjects
holding onto the identification variables, which are the variables defined in the
FROM
clause.
Example:
Employee e
; e is returnedIN (e.employees) AS emps
; emps is returnedManager m JOIN m.employees emps
; m and emps are returnedIdentificationVariableStateObjects
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
otherwiseprotected java.lang.String listName()
listName
in class AbstractListHolderStateObject<VariableDeclarationStateObject>
public void parse(java.lang.String jpqlFragment)
jpqlFragment
- The portion of the query representing one or several select itemsprotected 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