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

public abstract Class AggregateFunctionStateObject

extends AbstractSingleEncapsulatedExpressionStateObject
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.jpa.jpql.tools.model.query.AvgFunctionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.CountFunctionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.MinFunctionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.MaxFunctionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.SumFunctionStateObject
Annotations
@SuppressWarnings:nls, unused
Imports
java.io.IOException, org.eclipse.persistence.jpa.jpql.parser.AggregateFunction

In the SELECT clause the result of a query may be the result of an aggregate function applied to a path expression.
BNF: aggregate_expression ::= {AVG|MAX|MIN|SUM}([DISTINCT] state_field_path_expression) |
                             COUNT([DISTINCT] identification_variable | state_field_path_expression | single_valued_association_path_expression)
Author
Pascal Filion
Since
2.4
Version
2.4
See Also
AggregateFunction

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 visibility of the DISTINCT identifier has changed.

Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject:
STATE_OBJECT_PROPERTY

Constructor Summary

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

Creates a new AggregateFunctionStateObject.

protected
AggregateFunctionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
boolean
true to add DISTINCT to the query in order to have distinct values; false if it is not required
distinct
,
StateObject
The StateObject representing the encapsulated expression
stateObject
)

Creates a new AggregateStateObject.

protected
AggregateFunctionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
boolean
true to add DISTINCT to the query in order to have distinct values; false if it is not required
distinct
,
String
Either the identification variable or the state field path expression
path
)

Creates a new AggregateFunctionStateObject.

protected
AggregateFunctionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
StateObject
The StateObject representing the encapsulated expression
stateObject
)

Creates a new AggregateStateObject.

protected
AggregateFunctionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
String
Either the identification variable or the state field path expression
path
)

Creates a new AggregateFunctionStateObject.

Method Summary

Modifier and TypeMethod and Description
public AggregateFunction
getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject.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 boolean

Returns:

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

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

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

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject.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 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
setStateObject(StateObject
The new encapsulated StateObject
stateObject
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject.setStateObject.

Sets the given StateObject to represent the new encapsulated expression.
public void
toggleDistinct()

Reverses the visibility of the DISTINCT identifier.

protected void
toTextEncapsulatedExpression(Appendable
The writer used to print out the string representation of the encapsulated information
writer
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject.toTextEncapsulatedExpression.

Prints out a string representation of this encapsulated information, which should not be used to define a true string representation of a JPQL query but should be used for debugging purposes.
Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject:
addChildrengetQueryBNFIdgetStateObjecthasStateObjectparse

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 visibility of the DISTINCT identifier has changed.

Constructor Detail

AggregateFunctionStateObjectback to summary
protected AggregateFunctionStateObject(StateObject parent)

Creates a new AggregateFunctionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null
AggregateFunctionStateObjectback to summary
protected AggregateFunctionStateObject(StateObject parent, boolean distinct, StateObject stateObject)

Creates a new AggregateStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

distinct:boolean

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

stateObject:StateObject

The StateObject representing the encapsulated expression

Exceptions
NullPointerException:
The given parent cannot be null
AggregateFunctionStateObjectback to summary
protected AggregateFunctionStateObject(StateObject parent, boolean distinct, String path)

Creates a new AggregateFunctionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

distinct:boolean

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

path:String

Either the identification variable or the state field path expression

Exceptions
NullPointerException:
The given parent cannot be null
AggregateFunctionStateObjectback to summary
protected AggregateFunctionStateObject(StateObject parent, StateObject stateObject)

Creates a new AggregateStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

stateObject:StateObject

The StateObject representing the encapsulated expression

Exceptions
NullPointerException:
The given parent cannot be null
AggregateFunctionStateObjectback to summary
protected AggregateFunctionStateObject(StateObject parent, String path)

Creates a new AggregateFunctionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

path:String

Either the identification variable or the state field path expression

Exceptions
NullPointerException:
The given parent cannot be null

Method Detail

getExpressionback to summary
public AggregateFunction getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject.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:AggregateFunction

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
hasDistinctback to summary
public boolean hasDistinct()

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

Returns:boolean

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

isEquivalentback to summary
public boolean isEquivalent(StateObject stateObject)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject.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
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

setStateObjectback to summary
public void setStateObject(StateObject stateObject)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject.setStateObject.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject.setStateObject.

Sets the given StateObject to represent the new encapsulated expression.

Parameters
stateObject:StateObject

The new encapsulated StateObject

Annotations
@Override
toggleDistinctback to summary
public void toggleDistinct()

Reverses the visibility of the DISTINCT identifier.

toTextEncapsulatedExpressionback to summary
protected void toTextEncapsulatedExpression(Appendable writer) throws IOException

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject.toTextEncapsulatedExpression.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractEncapsulatedExpressionStateObject.toTextEncapsulatedExpression.

Prints out a string representation of this encapsulated information, which should not be used to define a true string representation of a JPQL query but should be used for debugging purposes.

Parameters
writer:Appendable

The writer used to print out the string representation of the encapsulated information

Annotations
@Override
Exceptions
IOException:
This should never happens, only required because Appendable is used instead of StringBuilder for instance