public abstract class AbstractSelectStatementStateObject extends AbstractStateObject
SELECT
clause and a FROM clause.SelectStatementStateObject,
FromClauseStateObject,
GroupByClauseStateObject,
HavingClauseStateObject,
SelectClauseStateObject,
WhereClauseStateObject,
AbstractSelectStatement| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
GROUP_BY_CLAUSE_PROPERTY
Notify the state object representing the
GROUP BY clause has changed. |
static java.lang.String |
HAVING_CLAUSE_PROPERTY
Notify the state object representing the
HAVING clause has changed. |
static java.lang.String |
WHERE_CLAUSE_PROPERTY
Notify the state object representing the
WHERE clause has changed. |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSelectStatementStateObject(StateObject parent)
Creates a new
AbstractSelectStatementStateObject. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addChildren(java.util.List<StateObject> children)
Adds the children of this
StateObject to the given list. |
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. |
GroupByClauseStateObject |
addGroupByClause()
Adds the
GROUP BY clause. |
GroupByClauseStateObject |
addGroupByClause(java.lang.String jpqlFragment)
Adds the
GROUP BY clause and parses the given JPQL fragment. |
HavingClauseStateObject |
addHavingClause()
Adds the
HAVING clause. |
HavingClauseStateObject |
addHavingClause(java.lang.String jpqlFragment)
Adds the
HAVING clause and parses the given JPQL fragment. |
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 to this select statement a new range variable declaration.
|
WhereClauseStateObject |
addWhereClause()
Adds the
WHERE clause. |
WhereClauseStateObject |
addWhereClause(java.lang.String jpqlFragment)
Adds the
WHERE clause and parses the given JPQL fragment. |
protected abstract AbstractFromClauseStateObject |
buildFromClause()
Creates the state object representing the
FROM clause. |
protected abstract AbstractSelectClauseStateObject |
buildSelectClause()
Creates the state object representing the
SELECT clause. |
ListIterable<? extends VariableDeclarationStateObject> |
declarations()
Returns the list of
VariableDeclarationStateObject defining the variable declarations,
which are mapping an entity to a variable or a collection-valued member to a variable. |
IdentificationVariableStateObject |
findIdentificationVariable(java.lang.String identificationVariable)
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.
|
AbstractSelectStatement |
getExpression()
Returns the actual parsed object if this
StateObject representation of the JPQL query
was created by parsing an existing JPQL query. |
AbstractFromClauseStateObject |
getFromClause()
Returns the state object representing the
FROM clause. |
GroupByClauseStateObject |
getGroupByClause()
Returns the state object representing the
GROUP BY clause. |
HavingClauseStateObject |
getHavingClause()
Returns the state object representing the
HAVING clause. |
AbstractSelectClauseStateObject |
getSelectClause()
Returns the state object representing the
SELECT clause. |
WhereClauseStateObject |
getWhereClause()
Returns the state object representing the
WHERE clause. |
boolean |
hasGroupByClause()
Returns the state object representing the
GROUP BY clause. |
boolean |
hasHavingClause()
Returns the state object representing the
HAVING clause. |
boolean |
hasWhereClause()
Returns the state object representing the
WHERE clause. |
java.lang.Iterable<IdentificationVariableStateObject> |
identificationVariables()
Returns the
IdentificationVariableStateObjects
holding onto the identification variables, which are the variables defined in the
FROM clause. |
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 |
parseSelect(java.lang.String jpqlFragment)
Parses the given JPQL fragment and create the select item.
|
void |
removeGroupByClause()
Removes the
GROUP BY clause. |
void |
removeHavingClause()
Removes the
HAVING clause. |
void |
removeWhereClause()
Removes the
WHERE clause. |
void |
toggleGroupByClause()
Either adds or removes the state object representing the
GROUP BY clause. |
void |
toggleHavingClause()
Either adds or removes the state object representing the
HAVING clause. |
void |
toggleWhereClause()
Either adds or removes the state object representing the
WHERE clause. |
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, firePropertyChanged, getChangeSupport, getDecorator, getGrammar, getManagedTypeProvider, getParent, getQueryBuilder, getRoot, getType, getType, getTypeHelper, getTypeRepository, hashCode, isDecorated, parent, parent, parent, removePropertyChangeListener, setExpression, setParent, toString, toString, toStringInternal, toStringItems, toTextclone, finalize, getClass, notify, notifyAll, wait, wait, waitacceptpublic static final java.lang.String GROUP_BY_CLAUSE_PROPERTY
GROUP BY clause has changed.public static final java.lang.String HAVING_CLAUSE_PROPERTY
HAVING clause has changed.public static final java.lang.String WHERE_CLAUSE_PROPERTY
WHERE clause has changed.protected AbstractSelectStatementStateObject(StateObject parent)
AbstractSelectStatementStateObject.parent - The parent of this state object, which cannot be nulljava.lang.NullPointerException - The given parent cannot be nullprotected void addChildren(java.util.List<StateObject> children)
StateObject to the given list.addChildren in class AbstractStateObjectchildren - The list used to store the childrenpublic 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
declarationpublic GroupByClauseStateObject addGroupByClause()
GROUP BY clause. The clause is not added if it's already present.GroupByClauseStateObjectpublic GroupByClauseStateObject addGroupByClause(java.lang.String jpqlFragment)
GROUP BY clause and parses the given JPQL fragment. The clause is
not added if it's already present.jpqlFragment - The fragment of the JPQL to parse that represents the group by items, the
fragment cannot start with GROUP BYGroupByClauseStateObjectpublic HavingClauseStateObject addHavingClause()
HAVING clause. The clause is not added if it's already present.GroupByClauseStateObjectpublic HavingClauseStateObject addHavingClause(java.lang.String jpqlFragment)
HAVING clause and parses the given JPQL fragment. The clause is
not added if it's already present.jpqlFragment - The fragment of the JPQL to parse that represents the conditional expression,
the fragment cannot start with HAVINGHavingClauseStateObjectpublic IdentificationVariableDeclarationStateObject addRangeDeclaration()
FROM clause.StateObject representing the new 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 given IEntityStateObject representing the new range variable declarationpublic IdentificationVariableDeclarationStateObject addRangeDeclaration(java.lang.String entityName, java.lang.String identificationVariable)
entityName - The name of the entityidentificationVariable - The unique identifier identifying the entityStateObject representing the range variable declarationpublic WhereClauseStateObject addWhereClause()
WHERE clause. The clause is not added if it's already present.GroupByClauseStateObjectpublic WhereClauseStateObject addWhereClause(java.lang.String jpqlFragment)
WHERE clause and parses the given JPQL fragment. The clause is
not added if it's already present.jpqlFragment - The fragment of the JPQL to parse that represents the conditional expression,
the fragment cannot start with WHEREWhereClauseStateObjectprotected abstract AbstractFromClauseStateObject buildFromClause()
FROM clause.AbstractFromClauseStateObjectprotected abstract AbstractSelectClauseStateObject buildSelectClause()
SELECT clause.AbstractSelectClauseStateObjectpublic ListIterable<? extends VariableDeclarationStateObject> declarations()
VariableDeclarationStateObject defining the variable declarations,
which are mapping an entity to a variable or a collection-valued member to a variable.
Example:
Employee eIN (e.employees) AS empsVariableDeclarationStateObjectpublic IdentificationVariableStateObject findIdentificationVariable(java.lang.String identificationVariable)
IdentificationVariableStateObject representing the given identification
variable.findIdentificationVariable in interface StateObjectfindIdentificationVariable in class AbstractStateObjectidentificationVariable - The name of the identification variable to retrieve its state objectIdentificationVariableStateObject defining the given identification variablepublic DeclarationStateObject getDeclaration()
getDeclaration in interface StateObjectgetDeclaration in class AbstractStateObjectStateObject 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 AbstractSelectStatement getExpression()
StateObject representation of the JPQL query
was created by parsing an existing JPQL query.getExpression in interface StateObjectgetExpression in class AbstractStateObjectStateObject
or null when the JPQL query is manually created (i.e. not from a string)public AbstractFromClauseStateObject getFromClause()
FROM clause.FROM clause, which is never
nullpublic GroupByClauseStateObject getGroupByClause()
GROUP BY clause.GROUP BY clause or
null if it's not presentpublic HavingClauseStateObject getHavingClause()
HAVING clause.HAVING clause or
null if it's not presentpublic AbstractSelectClauseStateObject getSelectClause()
SELECT clause.SELECT clause,
which is never nullpublic WhereClauseStateObject getWhereClause()
WHERE clause.WHERE clause or
the null state object since null is never returnedpublic boolean hasGroupByClause()
GROUP BY clause.GROUP BY clause or
null if it's not presentpublic boolean hasHavingClause()
HAVING clause.HAVING clause or
null if it's not presentpublic boolean hasWhereClause()
WHERE clause.WHERE clause or
null if it's not presentpublic 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 returnedIdentificationVariableStateObjectsprotected void initialize()
initialize in class AbstractStateObjectpublic boolean isEquivalent(StateObject stateObject)
StateObject is equivalent to this one, i.e. the
information of both StateObject is the same.isEquivalent in interface StateObjectisEquivalent in class AbstractStateObjectstateObject - The StateObject to compare its content to this onetrue if both object are equivalent; false otherwisepublic void parseSelect(java.lang.String jpqlFragment)
jpqlFragment - The portion of the query representing one or several select itemspublic void removeGroupByClause()
GROUP BY clause.public void removeHavingClause()
HAVING clause.public void removeWhereClause()
WHERE clause.public void toggleGroupByClause()
GROUP BY clause.public void toggleHavingClause()
HAVING clause.public void toggleWhereClause()
WHERE clause.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 AbstractStateObjectwriter - 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