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

public Class SumFunctionStateObject

extends AggregateFunctionStateObject
Class Inheritance
Imports
org.eclipse.persistence.jpa.jpql.parser.StateFieldPathExpressionBNF, .SumFunction

One of the aggregate functions. The arguments must be numeric.

SUM returns Long when applied to state-fields of integral types (other than BigInteger); Double when applied to state-fields of floating point types; BigInteger when applied to state-fields of type BigInteger; and BigDecimal when applied to state-fields of type BigDecimal. If SUM, AVG, MAX, or MIN is used, and there are no values to which the aggregate function can be applied, the result of the aggregate function is null. If COUNT is used, and there are no values to which COUNT can be applied, the result of the aggregate function is 0.

BNF: expression ::= SUM([DISTINCT] state_field_path_expression)

Author
Pascal Filion
Since
2.4
Version
2.4
See Also
SumFunction

Field Summary

Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.AggregateFunctionStateObject:
DISTINCT_PROPERTY

Constructor Summary

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

Creates a new SumFunctionStateObject.

public
SumFunctionStateObject(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 SumFunctionStateObject.

public
SumFunctionStateObject(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 SumFunctionStateObject.

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

Creates a new SumFunctionStateObject.

public
SumFunctionStateObject(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 SumFunctionStateObject.

Method Summary

Modifier and TypeMethod and Description
public void
public SumFunction
getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AggregateFunctionStateObject.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 String
protected String
getQueryBNFId()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject.getQueryBNFId.

Returns the unique identifier of the JPQLQueryBNF that will determine how to parse the encapsulated expression.
public void
setExpression(SumFunction
The parsed object representing a SUM expression
expression
)

Keeps a reference of the parsed object object, which should only be done when this object is instantiated during the conversion of a parsed JPQL query into StateObjects.

Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.AggregateFunctionStateObject:
hasDistinctisEquivalentsetDistinctsetStateObjecttoggleDistincttoTextEncapsulatedExpression

Constructor Detail

SumFunctionStateObjectback to summary
public SumFunctionStateObject(StateObject parent)

Creates a new SumFunctionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null
SumFunctionStateObjectback to summary
public SumFunctionStateObject(StateObject parent, boolean distinct, StateObject stateObject)

Creates a new SumFunctionStateObject.

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
SumFunctionStateObjectback to summary
public SumFunctionStateObject(StateObject parent, boolean distinct, String path)

Creates a new SumFunctionStateObject.

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
SumFunctionStateObjectback to summary
public SumFunctionStateObject(StateObject parent, StateObject stateObject)

Creates a new SumFunctionStateObject.

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
SumFunctionStateObjectback to summary
public SumFunctionStateObject(StateObject parent, String path)

Creates a new SumFunctionStateObject.

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

acceptback to summary
public void accept(StateObjectVisitor visitor)

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

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

Visits this StateObject by the given visitor.

Parameters
visitor:StateObjectVisitor

The visitor to visit this object

Annotations
@Override
getExpressionback to summary
public SumFunction getExpression()

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

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
getIdentifierback to summary
public String getIdentifier()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractEncapsulatedExpressionStateObject.getIdentifier.

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

Returns the JPQL identifier of the expression represented by this AbstractSingleEncapsulatedExpressionStateObject.

Returns:String

The JPQL identifier that is shown before the left parenthesis

Annotations
@Override
getQueryBNFIdback to summary
protected String getQueryBNFId()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSingleEncapsulatedExpressionStateObject.getQueryBNFId.

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

Returns the unique identifier of the JPQLQueryBNF that will determine how to parse the encapsulated expression.

Returns:String

The non-null ID of the BNF

Annotations
@Override
setExpressionback to summary
public void setExpression(SumFunction expression)

Keeps a reference of the parsed object object, which should only be done when this object is instantiated during the conversion of a parsed JPQL query into StateObjects.

Parameters
expression:SumFunction

The parsed object representing a SUM expression