Class AbstractScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
java.lang.Object
org.eclipse.persistence.jpa.jpql.tools.model.AbstractStateObjectBuilder
org.eclipse.persistence.jpa.jpql.tools.model.AbstractScalarExpressionStateObjectBuilder<T>
- All Implemented Interfaces:
IScalarExpressionStateObjectBuilder<T>
- Direct Known Subclasses:
AbstractConditionalExpressionStateObjectBuilder
,AbstractNewValueStateObjectBuilder
,AbstractSelectExpressionStateObjectBuilder
,AbstractSimpleSelectExpressionStateObjectBuilder
public abstract class AbstractScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
extends AbstractStateObjectBuilder
implements IScalarExpressionStateObjectBuilder<T>
This abstract definition of a builder provides the support for creating expressions defined by a
scalar expression
.- Since:
- 2.4
- Version:
- 2.4
-
Constructor Summary
ModifierConstructorDescriptionprotected
Creates a newAbstractScalarExpressionStateObjectBuilder
. -
Method Summary
Modifier and TypeMethodDescriptionCreates the expressionABS(x)
.Creates the expressionx + y
.protected void
arithmetic
(boolean plusSign) protected void
Creates the expressionAVG(path)
.avgDistinct
(String path) Creates the expressionAVG(DISTINCT path)
.protected StateObject
buildCollectionPath
(String path) protected StateObject
buildIdentificationVariable
(String literal) protected StateObject
buildInputParameter
(String parameter) protected StateObject
buildNumeric
(Number number) protected StateObject
buildNumeric
(String number) protected StateObject
buildStateFieldPath
(String path) protected StateObject
buildStringLiteral
(String literal) case_
(ICaseExpressionStateObjectBuilder builder) Creates a newCASE
expression.Create the expressionCOALESCE(scalar_expression {, scalar_expression}+)
.Create the expressionCOALESCE(scalar_expression {, scalar_expression}+)
.Creates the expressionCONCAT(string_primary, string_primary {, string_primary}*)
.Creates the expressionCONCAT(string_primary, string_primary {, string_primary}*)
.protected void
Creates the expressionCOUNT(identification_variable | state_field_path_expression | single_valued_object_path_expression)
.countDistinct
(String path) Creates the expressionCOUNT(DISTINCT identification_variable | state_field_path_expression | single_valued_object_path_expression)
.Creates the expression representingCURRENT_DATE
.Creates the expression representingCURRENT_TIME
.Creates the expression representingCURRENT_TIMESTAMP
.Creates a new date using the JDBC syntax of a date.Creates the expressionx / y
.entityType
(String entityTypeName) Creates a new entity type literal.enumLiteral
(Enum<? extends Enum<?>> enumConstant) Creates a new enum literal.Creates the expression<identifier>('functionName' {, expression}*)
.Creates the expression<identifier>('functionName' {, expression}*)
.Creates the expression<identifier>('functionName' {, expression}*)
.Returns the builder that can create aCASE
expression, which requires aIConditionalExpressionStateObjectBuilder
to build theWHEN
clauses.protected StateObject
Returns the parent of the expression to build, which is only required when a JPQL fragment needs to be parsed.Creates the expressionINDEX(identification_variable)
.Creates the expressionLENGTH(expression)
.protected StateObject
protected List
<StateObject> Creates the expressionLOCATE(string_primary, string_primary)
.Creates the expressionLOCATE(string_primary, string_primary [, simple_arithmetic_expression])
.protected void
Creates the expressionMAX(path)
.maxDistinct
(String path) Creates the expressionMAX(DISTINCT path)
.protected void
Creates the expressionAVG(path)
.minDistinct
(String path) Creates the expressionAVG(DISTINCT path)
.Creates the expression- x
.Creates the expressionMOD(simple_arithmetic_expression, simple_arithmetic_expression)
.Creates the expressionx * y
.Create the expressionNULLIF(scalar_expression, scalar_expression)
.Creates the numeric literal.Creates the numeric literal.Creates the input parameter.Creates a new state field path expression.Creates the expression+ x
.Creates the expressionSIZE(collection_valued_path_expression)
.Creates the expressionSQRT(x)
.protected List
<StateObject> stateObjects
(int count) Returns a list of theStateObjects
that were previously created.protected List
<StateObject> stateObjects
(T... builders) Returns a list of theStateObjects
that were previously created.Creates a new string literal.Creates an encapsulated expression:(expression)
.Creates the expressionx - y
.protected void
Creates the expressionSUM(path)
.sumDistinct
(String path) Creates the expressionSUM(path)
.Creates the expressionTYPE(identification_variable | single_valued_object_path_expression | input_parameter)
.Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.AbstractStateObjectBuilder
add, checkBuilder, checkBuilders, hasStateObjects, pop
-
Constructor Details
-
AbstractScalarExpressionStateObjectBuilder
Creates a newAbstractScalarExpressionStateObjectBuilder
.- Parameters:
parent
- The parent of the expression to build, which is only required when a JPQL fragment needs to be parsed
-
-
Method Details
-
abs
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionABS(x)
.- Specified by:
abs
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder
- The parameter of theABS
expression- Returns:
- This builder
-
add
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionx + y
.- Specified by:
add
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder
- The right side of the addition expression- Returns:
- This builder
-
arithmetic
protected void arithmetic(boolean plusSign) -
avg
-
avg
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionAVG(path)
.- Specified by:
avg
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The state field path expression- Returns:
- This builder
-
avgDistinct
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionAVG(DISTINCT path)
.- Specified by:
avgDistinct
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The state field path expression- Returns:
- This builder
-
buildCollectionPath
-
buildIdentificationVariable
-
buildInputParameter
-
buildNumeric
-
buildNumeric
-
buildStateFieldPath
-
buildStringLiteral
-
case_
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates a newCASE
expression.- Specified by:
case_
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder
- Thebuilder
of aCASE
expression- Returns:
- This builder
-
coalesce
Description copied from interface:IScalarExpressionStateObjectBuilder
Create the expressionCOALESCE(scalar_expression {, scalar_expression}+)
.- Specified by:
coalesce
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder1
- The first scalar expressionbuilder2
- The second scalar expression- Returns:
- This builder
-
coalesce
Description copied from interface:IScalarExpressionStateObjectBuilder
Create the expressionCOALESCE(scalar_expression {, scalar_expression}+)
.- Specified by:
coalesce
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder1
- The first scalar expressionbuilder2
- The second scalar expressionbuilders
- The subsequent scalar expressions- Returns:
- This builder
-
concat
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionCONCAT(string_primary, string_primary {, string_primary}*)
.- Specified by:
concat
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder1
- The first argument of the expressionbuilder2
- The second argument of the expression- Returns:
- This builder
-
concat
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionCONCAT(string_primary, string_primary {, string_primary}*)
.- Specified by:
concat
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder1
- The first argument of the expressionbuilder2
- The second argument of the expressionbuilders
- The subsequence arguments of the expression, which are optional- Returns:
- This builder
-
count
-
count
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionCOUNT(identification_variable | state_field_path_expression | single_valued_object_path_expression)
.- Specified by:
count
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The state field path expression- Returns:
- This builder
-
countDistinct
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionCOUNT(DISTINCT identification_variable | state_field_path_expression | single_valued_object_path_expression)
.- Specified by:
countDistinct
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The state field path expression- Returns:
- This builder
-
currentDate
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expression representingCURRENT_DATE
.- Specified by:
currentDate
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Returns:
- This builder
-
currentTime
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expression representingCURRENT_TIME
.- Specified by:
currentTime
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Returns:
- This builder
-
currentTimestamp
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expression representingCURRENT_TIMESTAMP
.- Specified by:
currentTimestamp
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Returns:
- This builder
-
date
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates a new date using the JDBC syntax of a date.- Specified by:
date
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Returns:
- This builder
-
divide
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionx / y
.- Specified by:
divide
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder
- The right side of the division expression- Returns:
- This builder
-
entityType
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates a new entity type literal.- Specified by:
entityType
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
entityTypeName
- The short name of the entity- Returns:
- This builder
-
enumLiteral
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates a new enum literal.- Specified by:
enumLiteral
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
enumConstant
- The enum constant- Returns:
- This builder
-
function
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expression<identifier>('functionName' {, expression}*)
.- Specified by:
function
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
identifier
- The JPQL identifier that is used to identify the SQL expressionfunctionName
- The name of the native SQL functionarguments
- The arguments of the expression- Returns:
- This builder
-
function
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expression<identifier>('functionName' {, expression}*)
.- Specified by:
function
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
identifier
- The JPQL identifier that is used to identify the SQL expressionfunctionName
- The name of the native SQL function- Returns:
- This builder
-
function
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expression<identifier>('functionName' {, expression}*)
.- Specified by:
function
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
identifier
- The JPQL identifier that is used to identify the SQL expressionfunctionName
- The name of the native SQL functionarguments
- The arguments of the expression- Returns:
- This builder
-
getCaseBuilder
Description copied from interface:IScalarExpressionStateObjectBuilder
Returns the builder that can create aCASE
expression, which requires aIConditionalExpressionStateObjectBuilder
to build theWHEN
clauses.- Specified by:
getCaseBuilder
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Returns:
- The builder of a
CASE
expression
-
getParent
Returns the parent of the expression to build, which is only required when a JPQL fragment needs to be parsed.- Returns:
- The parent
-
index
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionINDEX(identification_variable)
.- Specified by:
index
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
variable
- The identification variable- Returns:
- This builder
-
length
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionLENGTH(expression)
.- Specified by:
length
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder
- The encapsulated expression- Returns:
- This builder
-
literal
-
literals
-
locate
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionLOCATE(string_primary, string_primary)
.- Specified by:
locate
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
parameter1
- The first string primaryparameter2
- The second string primary- Returns:
- This builder
-
locate
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionLOCATE(string_primary, string_primary [, simple_arithmetic_expression])
.- Specified by:
locate
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
parameter1
- The first string primaryparameter2
- The second string primaryparameter3
- The position of the search within the string- Returns:
- This builder
-
max
-
max
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionMAX(path)
.- Specified by:
max
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The state field path expression- Returns:
- This builder
-
maxDistinct
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionMAX(DISTINCT path)
.- Specified by:
maxDistinct
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The state field path expression- Returns:
- This builder
-
min
-
min
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionAVG(path)
.- Specified by:
min
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The state field path expression- Returns:
- This builder
-
minDistinct
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionAVG(DISTINCT path)
.- Specified by:
minDistinct
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The state field path expression- Returns:
- This builder
-
minus
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expression- x
.- Specified by:
minus
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder
- The expression that will have the plus sign prepended- Returns:
- This builder
-
mod
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionMOD(simple_arithmetic_expression, simple_arithmetic_expression)
.- Specified by:
mod
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
parameter1
- The first parameterparameter2
- The second parameter- Returns:
- This builder
-
multiply
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionx * y
.- Specified by:
multiply
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder
- The right side of the multiply expression- Returns:
- This builder
-
nullIf
Description copied from interface:IScalarExpressionStateObjectBuilder
Create the expressionNULLIF(scalar_expression, scalar_expression)
.- Specified by:
nullIf
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder1
- The first scalar expressionbuilder2
- The second scalar expression- Returns:
- This builder
-
numeric
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the numeric literal.- Specified by:
numeric
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
number
- The numeric literal- Returns:
- This builder
-
numeric
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the numeric literal.- Specified by:
numeric
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
number
- The numeric literal- Returns:
- This builder
-
parameter
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the input parameter.- Specified by:
parameter
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
parameter
- The named or positional input parameter- Returns:
- This builder
-
path
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates a new state field path expression.- Specified by:
path
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The state field path path expression- Returns:
- This builder
-
plus
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expression+ x
.- Specified by:
plus
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder
- The expression that will have the plus sign prepended- Returns:
- This builder
-
size
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionSIZE(collection_valued_path_expression)
.- Specified by:
size
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The collection-valued path expression- Returns:
- This builder
-
sqrt
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionSQRT(x)
.- Specified by:
sqrt
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder
- The parameter of theABS
expression- Returns:
- This builder
-
stateObjects
Returns a list of theStateObjects
that were previously created.- Parameters:
count
- The number ofStateObjects
to move to the list- Returns:
- The list of
StateObjects
that were added to the stack
-
stateObjects
Returns a list of theStateObjects
that were previously created.- Parameters:
builders
- The list ofbuilders
is used to determine how manyStateObjects
needs to be pulled out of the stack- Returns:
- The list of
StateObjects
that were added to the stack
-
string
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates a new string literal.- Specified by:
string
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
literal
- The string literal- Returns:
- This builder
-
sub
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates an encapsulated expression:(expression)
.- Specified by:
sub
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder
- The expression that will be encapsulated- Returns:
- This builder
-
subtract
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionx - y
.- Specified by:
subtract
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder
- The right side of the addition expression- Returns:
- This builder
-
sum
-
sum
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionSUM(path)
.- Specified by:
sum
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The state field path expression- Returns:
- This builder
-
sumDistinct
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionSUM(path)
.- Specified by:
sumDistinct
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The state field path expression- Returns:
- This builder
-
type
Description copied from interface:IScalarExpressionStateObjectBuilder
Creates the expressionTYPE(identification_variable | single_valued_object_path_expression | input_parameter)
.- Specified by:
type
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The identification variable or the input parameter- Returns:
- This builder
-