Top Description Fields Constructors Methods
org.eclipse.persistence.jpa.jpql.tools.model.query

public abstract Class AbstractSelectClauseStateObject

extends AbstractStateObject
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.jpa.jpql.tools.model.query.SelectClauseStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleSelectClauseStateObject
Annotations
@SuppressWarnings:nls
Imports
org.eclipse.persistence.jpa.jpql.parser.AbstractSelectClause

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.
Author
Pascal Filion
Since
2.4
Version
2.4
See Also
AbstractSelectStatementStateObject, SelectClauseStateObject, AbstractSelectClause

Field Summary

Modifier and TypeField and Description
private boolean
distinct

Determines whether the DISTINCT keyword is part of the query, which is used to return only distinct (different) values.

public static final String
DISTINCT_PROPERTY

Notifies the distinct property has changed.

Constructor Summary

AccessConstructor and Description
protected
AbstractSelectClauseStateObject(AbstractSelectStatementStateObject
The parent of this state object, which cannot be null
parent
)

Creates a new AbstractSelectClauseStateObject.

Method Summary

Modifier and TypeMethod and Description
public AbstractSelectClause
getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.getExpression.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

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

Returns:

The state object representing the FROM clause
getFromClause
()

Returns the AbstractFromClauseStateObject representing the FROM clause.

public AbstractSelectStatementStateObject
public boolean
hasDistinct()

Gets whether the DISTINCT keyword is part of the query, which is used to return only distinct (different) values

public abstract boolean

Returns:

true if this state object has children; false otherwise
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).

public boolean
isEquivalent(StateObject
The StateObject to compare its content to this one
stateObject
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.isEquivalent.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.isEquivalent.

Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.
public abstract void
parse(String
The portion of the query representing one or several select items
jpqlFragment
)

Parses the given JPQL fragment and create the select item.

public void
setDistinct(boolean
true to add DISTINCT to the query in order to have distinct values; false if it is not required
distinct
)

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

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.

Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject:
acceptUnknownVisitoracceptUnknownVisitoraddChildrenaddProblemsaddPropertyChangeListenerareEquivalentbuildProblembuildProblembuildStateObjectbuildStateObjectscheckParentchildrendecorateequalsfindIdentificationVariablefirePropertyChangedgetChangeSupportgetDeclarationgetDecoratorgetGrammargetManagedTypeProvidergetQueryBuildergetRootgetTypegetTypegetTypeHelpergetTypeRepositoryhashCodeinitializeisDecoratedparentparentparentremovePropertyChangeListenersetExpressionsetParenttoStringtoStringtoStringInternaltoStringItemstoTexttoTextInternal

Field Detail

distinctback to summary
private boolean distinct

Determines whether the DISTINCT keyword is part of the query, which is used to return only distinct (different) values.

DISTINCT_PROPERTYback to summary
public static final String DISTINCT_PROPERTY

Notifies the distinct property has changed.

Constructor Detail

AbstractSelectClauseStateObjectback to summary
protected AbstractSelectClauseStateObject(AbstractSelectStatementStateObject parent)

Creates a new AbstractSelectClauseStateObject.

Parameters
parent:AbstractSelectStatementStateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null

Method Detail

getExpressionback to summary
public AbstractSelectClause getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.getExpression.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

Returns the actual parsed object if this StateObject representation of the JPQL query was created by parsing an existing JPQL query.

Returns:AbstractSelectClause

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)

Annotations
@Override
getFromClauseback to summary
public AbstractFromClauseStateObject getFromClause()

Returns the AbstractFromClauseStateObject representing the FROM clause.

Returns:AbstractFromClauseStateObject

The state object representing the FROM clause

getParentback to summary
public AbstractSelectStatementStateObject getParent()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.getParent.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getParent.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getParent.

Returns the parent of this StateObject.

Returns:AbstractSelectStatementStateObject

Returns the parent of this StateObject, which is null only when this is the root of the hierarchy

Annotations
@Override
hasDistinctback to summary
public boolean hasDistinct()

Gets whether the DISTINCT keyword is part of the query, which is used to return only distinct (different) values

hasSelectItemback to summary
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:boolean

true if this state object has children; false otherwise

isEquivalentback to summary
public boolean isEquivalent(StateObject stateObject)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.isEquivalent.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.isEquivalent.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.isEquivalent.

Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.

Parameters
stateObject:StateObject

The StateObject to compare its content to this one

Returns:boolean

true if both object are equivalent; false otherwise

Annotations
@Override
parseback to summary
public abstract void parse(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:String

The portion of the query representing one or several select items

setDistinctback to summary
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:boolean

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

toggleDistinctback to summary
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.