EclipseLink 2.4.2, build 'v20130514-5956486' API Reference

org.eclipse.persistence.jpa.jpql.model.query
Class AbstractSelectClauseStateObject

java.lang.Object
  extended by org.eclipse.persistence.jpa.jpql.model.query.AbstractStateObject
      extended by org.eclipse.persistence.jpa.jpql.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 a SELECT clause, which is either the SELECT clause of the top-level query or of a subquery.

Version:
2.4
See Also:
AbstractSelectStatementStateObject, SelectClauseStateObject, SubQuerySelectClauseStateObject, AbstractSelectClause
Author:
Pascal Filion
Since:
2.4

Field Summary
static java.lang.String DISTINCT_PROPERTY
          Notifies the distinct property has changed.
 
Constructor Summary
protected AbstractSelectClauseStateObject(AbstractSelectStatementStateObject parent)
          Creates a new AbstractSelectClauseStateObject.
 
Method Summary
 AbstractSelectClause 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 AbstractFromClauseStateObject representing the FROM clause.
 AbstractSelectStatementStateObject getParent()
          Returns the parent of this StateObject.
 boolean hasDistinct()
          Sets whether the DISTINCT keyword should be part of the query, which is used to return only distinct (different) values
abstract  boolean hasSelectItem()
          Determines whether this SELECT clause has a select item defined (only one can be set for a subquery's SELECT clause and many for a top-level query).
 boolean isEquivalent(StateObject stateObject)
          Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.
abstract  void parse(java.lang.String jpqlFragment)
          Parses the given JPQL fragment and create the select item.
 void setDistinct(boolean distinct)
          Sets whether the DISTINCT keyword should be part of the query, which is used to return only distinct (different) values
 void toggleDistinct()
          Changes the state of the DISTINCT 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.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.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 new AbstractSelectClauseStateObject.

Parameters:
parent - The parent of this state object, which cannot be null
Throws:
java.lang.NullPointerException - The given parent cannot be null
Method Detail

getExpression

public AbstractSelectClause getExpression()
Returns the actual parsed object if this StateObject representation of the JPQL query was created by parsing an existing JPQL query.

Specified by:
getExpression in interface StateObject
Overrides:
getExpression in class AbstractStateObject
Returns:
The parsed object when a JPQL query is parsed and converted into a StateObject or null when the JPQL query is manually created (i.e. not from a string)

getFromClause

public AbstractFromClauseStateObject getFromClause()
Returns the AbstractFromClauseStateObject representing the FROM clause.

Returns:
The state object representing the FROM clause

getParent

public AbstractSelectStatementStateObject getParent()
Returns the parent of this StateObject.

Specified by:
getParent in interface StateObject
Overrides:
getParent in class AbstractStateObject
Returns:
Returns the parent of this StateObject, which is null only when this is the root of the hierarchy

hasDistinct

public boolean hasDistinct()
Sets whether the DISTINCT keyword should be part of the query, which is used to return only distinct (different) values

Parameters:
distinct - true to add DISTINCT to the query in order to have distinct values; false if it is not required

hasSelectItem

public abstract boolean hasSelectItem()
Determines whether this SELECT clause has a select item defined (only one can be set for a subquery's SELECT clause and many for a top-level query).

Returns:
true if this state object has children; false otherwise

isEquivalent

public boolean isEquivalent(StateObject stateObject)
Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.

Specified by:
isEquivalent in interface StateObject
Overrides:
isEquivalent in class AbstractStateObject
Parameters:
stateObject - The StateObject to compare its content to this one
Returns:
true if both object are equivalent; false otherwise

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 the DISTINCT keyword should be part of the query, which is used to return only distinct (different) values

Parameters:
distinct - true to add DISTINCT to the query in order to have distinct values; false if it is not required

toggleDistinct

public void toggleDistinct()
Changes the state of the DISTINCT identifier; either adds it if it's not present or removes it if it's present.


EclipseLink 2.4.2, build 'v20130514-5956486' API Reference