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
This state object represents the abstract definition of a
SELECT
clause,
which is either the SELECT
clause of the top-level query or of a subquery.- Since:
- 2.4
- Version:
- 2.4
- See Also:
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
Creates a newAbstractSelectClauseStateObject
. -
Method Summary
Modifier and TypeMethodDescriptionReturns the actual parsed object if thisStateObject
representation of the JPQL query was created by parsing an existing JPQL query.Returns theAbstractFromClauseStateObject
representing the FROM clause.Returns the parent of thisStateObject
.boolean
Gets whether theDISTINCT
keyword is part of the query, which is used to return only distinct (different) valuesabstract boolean
Determines whether thisSELECT
clause has a select item defined (only one can be set for a subquery'sSELECT
clause and many for a top-level query).boolean
isEquivalent
(StateObject stateObject) Determines whether the givenStateObject
is equivalent to this one, i.e.abstract void
Parses the given JPQL fragment and create the select item.void
setDistinct
(boolean distinct) Sets whether theDISTINCT
keyword should be part of the query, which is used to return only distinct (different) valuesvoid
Changes the state of theDISTINCT
identifier; 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 Details
-
DISTINCT_PROPERTY
Notifies the distinct property has changed.- See Also:
-
-
Constructor Details
-
AbstractSelectClauseStateObject
Creates a newAbstractSelectClauseStateObject
.- Parameters:
parent
- The parent of this state object, which cannot benull
- Throws:
NullPointerException
- The given parent cannot benull
-
-
Method Details
-
getExpression
Description copied from interface:StateObject
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)
-
getFromClause
Returns theAbstractFromClauseStateObject
representing the FROM clause.- Returns:
- The state object representing the FROM clause
-
getParent
Description copied from interface:StateObject
Returns the parent of thisStateObject
.- Specified by:
getParent
in interfaceStateObject
- Overrides:
getParent
in classAbstractStateObject
- Returns:
- Returns the parent of this
StateObject
, which isnull
only when this is the root of the hierarchy
-
hasDistinct
public boolean hasDistinct()Gets whether theDISTINCT
keyword is part of the query, which is used to return only distinct (different) values -
hasSelectItem
public abstract boolean hasSelectItem()Determines whether thisSELECT
clause has a select item defined (only one can be set for a subquery'sSELECT
clause and many for a top-level query).- Returns:
true
if this state object has children;false
otherwise
-
isEquivalent
Description copied from interface: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 classAbstractStateObject
- Parameters:
stateObject
- TheStateObject
to compare its content to this one- Returns:
true
if both object are equivalent;false
otherwise
-
parse
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 theDISTINCT
keyword should be part of the query, which is used to return only distinct (different) values- Parameters:
distinct
-true
to addDISTINCT
to the query in order to have distinct values;false
if it is not required
-
toggleDistinct
public void toggleDistinct()Changes the state of theDISTINCT
identifier; either adds it if it's not present or removes it if it's present.
-