Class AbstractSelectClauseStateObject
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectClauseStateObject
-
- All Implemented Interfaces:
StateObject
- Direct Known Subclasses:
SelectClauseStateObject,SimpleSelectClauseStateObject
public abstract class AbstractSelectClauseStateObject extends AbstractStateObject
This state object represents the abstract definition of aSELECTclause, which is either theSELECTclause of the top-level query or of a subquery.- Version:
- 2.4
- See Also:
AbstractSelectStatementStateObject,SelectClauseStateObject,AbstractSelectClause- Author:
- Pascal Filion
- Since:
- 2.4
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDISTINCT_PROPERTYNotifies the distinct property has changed.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractSelectClauseStateObject(AbstractSelectStatementStateObject parent)Creates a newAbstractSelectClauseStateObject.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description AbstractSelectClausegetExpression()Returns the actual parsed object if thisStateObjectrepresentation of the JPQL query was created by parsing an existing JPQL query.AbstractFromClauseStateObjectgetFromClause()Returns theAbstractFromClauseStateObjectrepresenting the FROM clause.AbstractSelectStatementStateObjectgetParent()Returns the parent of thisStateObject.booleanhasDistinct()Gets whether theDISTINCTkeyword is part of the query, which is used to return only distinct (different) valuesabstract booleanhasSelectItem()Determines whether thisSELECTclause has a select item defined (only one can be set for a subquery'sSELECTclause and many for a top-level query).booleanisEquivalent(StateObject stateObject)Determines whether the givenStateObjectis equivalent to this one, i.e. the information of bothStateObjectis the same.abstract voidparse(java.lang.String jpqlFragment)Parses the given JPQL fragment and create the select item.voidsetDistinct(boolean distinct)Sets whether theDISTINCTkeyword should be part of the query, which is used to return only distinct (different) valuesvoidtoggleDistinct()Changes the state of theDISTINCTidentifier; either adds it if it's not present or removes it if it's present.-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
acceptUnknownVisitor, acceptUnknownVisitor, addChildren, addProblems, addPropertyChangeListener, areEquivalent, buildProblem, buildProblem, buildStateObject, buildStateObjects, checkParent, children, decorate, equals, findIdentificationVariable, firePropertyChanged, getChangeSupport, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getQueryBuilder, getRoot, getType, getType, getTypeHelper, getTypeRepository, hashCode, initialize, isDecorated, parent, parent, parent, removePropertyChangeListener, setExpression, setParent, toString, toString, toStringInternal, toStringItems, toText, toTextInternal
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject
accept
-
-
-
-
Field Detail
-
DISTINCT_PROPERTY
public static final java.lang.String DISTINCT_PROPERTY
Notifies the distinct property has changed.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractSelectClauseStateObject
protected AbstractSelectClauseStateObject(AbstractSelectStatementStateObject parent)
Creates a newAbstractSelectClauseStateObject.- Parameters:
parent- The parent of this state object, which cannot benull- Throws:
java.lang.NullPointerException- The given parent cannot benull
-
-
Method Detail
-
getExpression
public AbstractSelectClause getExpression()
Returns 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)
-
getFromClause
public AbstractFromClauseStateObject getFromClause()
Returns theAbstractFromClauseStateObjectrepresenting the FROM clause.- Returns:
- The state object representing the FROM clause
-
getParent
public AbstractSelectStatementStateObject getParent()
Returns the parent of thisStateObject.- Specified by:
getParentin interfaceStateObject- Overrides:
getParentin classAbstractStateObject- Returns:
- Returns the parent of this
StateObject, which isnullonly when this is the root of the hierarchy
-
hasDistinct
public boolean hasDistinct()
Gets whether theDISTINCTkeyword is part of the query, which is used to return only distinct (different) values
-
hasSelectItem
public abstract boolean hasSelectItem()
Determines whether thisSELECTclause has a select item defined (only one can be set for a subquery'sSELECTclause and many for a top-level query).- Returns:
trueif this state object has children;falseotherwise
-
isEquivalent
public boolean isEquivalent(StateObject stateObject)
Determines whether the givenStateObjectis equivalent to this one, i.e. the information of bothStateObjectis the same.- Specified by:
isEquivalentin interfaceStateObject- Overrides:
isEquivalentin classAbstractStateObject- Parameters:
stateObject- TheStateObjectto compare its content to this one- Returns:
trueif both object are equivalent;falseotherwise
-
parse
public abstract void parse(java.lang.String jpqlFragment)
Parses the given JPQL fragment and create the select item. For the top-level query, the fragment can contain several select items but for a subquery, it can represent only one.- Parameters:
jpqlFragment- The portion of the query representing one or several select items
-
setDistinct
public void setDistinct(boolean distinct)
Sets whether theDISTINCTkeyword should be part of the query, which is used to return only distinct (different) values- Parameters:
distinct-trueto addDISTINCTto the query in order to have distinct values;falseif it is not required
-
toggleDistinct
public void toggleDistinct()
Changes the state of theDISTINCTidentifier; either adds it if it's not present or removes it if it's present.
-
-