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 ascalar expression
.- Since:
- 2.4
- Version:
- 2.4
- Author:
- Pascal Filion
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
abs(T builder)
Creates the expressionABS(x)
.T
add(T builder)
Creates the expressionx + y
.T
avg(String path)
Creates the expressionAVG(path)
.T
avgDistinct(String path)
Creates the expressionAVG(DISTINCT path)
.T
case_(ICaseExpressionStateObjectBuilder builder)
Creates a newCASE
expression.T
coalesce(T builder1, T builder2, T... builders)
Create the expressionCOALESCE(scalar_expression {, scalar_expression}+)
.T
concat(T builder1, T builder2, T... builders)
Creates the expressionCONCAT(string_primary, string_primary {, string_primary}*)
.T
count(String path)
Creates the expressionCOUNT(identification_variable | state_field_path_expression | single_valued_object_path_expression)
.T
countDistinct(String path)
Creates the expressionCOUNT(DISTINCT identification_variable | state_field_path_expression | single_valued_object_path_expression)
.T
currentDate()
Creates the expression representingCURRENT_DATE
.T
currentTime()
Creates the expression representingCURRENT_TIME
.T
currentTimestamp()
Creates the expression representingCURRENT_TIMESTAMP
.T
date(String jdbcDate)
Creates a new date using the JDBC syntax of a date.T
divide(T builder)
Creates the expressionx / y
.T
entityType(String entityTypeName)
Creates a new entity type literal.T
enumLiteral(Enum<? extends Enum<?>> enumConstant)
Creates a new enum literal.T
function(String identifier, String functionName, String... arguments)
Creates the expression<identifier>('functionName' {, expression}*)
.T
function(String identifier, String functionName, T... arguments)
Creates the expression<identifier>('functionName' {, expression}*)
.ICaseExpressionStateObjectBuilder
getCaseBuilder()
Returns the builder that can create aCASE
expression, which requires aIConditionalExpressionStateObjectBuilder
to build theWHEN
clauses.T
index(String variable)
Creates the expressionINDEX(identification_variable)
.T
length(T builder)
Creates the expressionLENGTH(expression)
.T
locate(T parameter1, T parameter2)
Creates the expressionLOCATE(string_primary, string_primary)
.T
locate(T parameter1, T parameter2, T parameter3)
Creates the expressionLOCATE(string_primary, string_primary [, simple_arithmetic_expression])
.T
max(String path)
Creates the expressionMAX(path)
.T
maxDistinct(String path)
Creates the expressionMAX(DISTINCT path)
.T
min(String path)
Creates the expressionAVG(path)
.T
minDistinct(String path)
Creates the expressionAVG(DISTINCT path)
.T
minus(T builder)
Creates the expression- x
.T
mod(T parameter1, T parameter2)
Creates the expressionMOD(simple_arithmetic_expression, simple_arithmetic_expression)
.T
multiply(T builder)
Creates the expressionx * y
.T
nullIf(T builder1, T builder2)
Create the expressionNULLIF(scalar_expression, scalar_expression)
.T
numeric(Number number)
Creates the numeric literal.T
numeric(String number)
Creates the numeric literal.T
parameter(String parameter)
Creates the input parameter.T
path(String path)
Creates a new state field path expression.T
plus(T builder)
Creates the expression+ x
.T
size(String path)
Creates the expressionSIZE(collection_valued_path_expression)
.T
sqrt(T builder)
Creates the expressionSQRT(x)
.T
string(String literal)
Creates a new string literal.T
sub(T builder)
Creates an encapsulated expression:(expression)
.T
subtract(T builder)
Creates the expressionx - y
.T
sum(String path)
Creates the expressionSUM(path)
.T
sumDistinct(String path)
Creates the expressionSUM(path)
.T
type(String path)
Creates the expressionTYPE(identification_variable | single_valued_object_path_expression | input_parameter)
.
-
-
-
Method Detail
-
abs
public T abs(T builder)
Creates the expressionABS(x)
.- Specified by:
abs
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder
- The parameter of theABS
expression- Returns:
- This This builder
-
add
public T add(T builder)
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
-
avg
public T avg(String path)
Creates the expressionAVG(path)
.- Specified by:
avg
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The state field path expression- Returns:
- This This builder
-
avgDistinct
public T avgDistinct(String path)
Creates the expressionAVG(DISTINCT path)
.- Specified by:
avgDistinct
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The state field path expression- Returns:
- This This builder
-
case_
public T case_(ICaseExpressionStateObjectBuilder builder)
Creates a newCASE
expression.- Specified by:
case_
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder
- Thebuilder
of aCASE
expression- Returns:
- This This builder
-
coalesce
public T coalesce(T builder1, T builder2, T... builders)
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 This builder
-
concat
public T concat(T builder1, T builder2, T... builders)
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 This builder
-
count
public T count(String path)
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 This builder
-
countDistinct
public T countDistinct(String path)
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 This builder
-
currentDate
public T currentDate()
Creates the expression representingCURRENT_DATE
.- Specified by:
currentDate
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Returns:
- This This builder
-
currentTime
public T currentTime()
Creates the expression representingCURRENT_TIME
.- Specified by:
currentTime
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Returns:
- This This builder
-
currentTimestamp
public T currentTimestamp()
Creates the expression representingCURRENT_TIMESTAMP
.- Specified by:
currentTimestamp
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Returns:
- This This builder
-
date
public T date(String jdbcDate)
Creates a new date using the JDBC syntax of a date.- Specified by:
date
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Returns:
- This This builder
-
divide
public T divide(T builder)
Creates the expressionx / y
.- Specified by:
divide
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder
- The right side of the division expression- Returns:
- This This builder
-
entityType
public T entityType(String entityTypeName)
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 This builder
-
enumLiteral
public T enumLiteral(Enum<? extends Enum<?>> enumConstant)
Creates a new enum literal.- Specified by:
enumLiteral
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
enumConstant
- The enum constant- Returns:
- This This builder
-
function
public T function(String identifier, String functionName, String... arguments)
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
public T function(String identifier, String functionName, T... arguments)
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
public ICaseExpressionStateObjectBuilder getCaseBuilder()
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
-
index
public T index(String variable)
Creates the expressionINDEX(identification_variable)
.- Specified by:
index
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
variable
- The identification variable- Returns:
- This This builder
-
length
public T length(T builder)
Creates the expressionLENGTH(expression)
.- Specified by:
length
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder
- The encapsulated expression- Returns:
- This This builder
-
locate
public T locate(T parameter1, T parameter2)
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 This builder
-
locate
public T locate(T parameter1, T parameter2, T parameter3)
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 This builder
-
max
public T max(String path)
Creates the expressionMAX(path)
.- Specified by:
max
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The state field path expression- Returns:
- This This builder
-
maxDistinct
public T maxDistinct(String path)
Creates the expressionMAX(DISTINCT path)
.- Specified by:
maxDistinct
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The state field path expression- Returns:
- This This builder
-
min
public T min(String path)
Creates the expressionAVG(path)
.- Specified by:
min
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The state field path expression- Returns:
- This This builder
-
minDistinct
public T minDistinct(String path)
Creates the expressionAVG(DISTINCT path)
.- Specified by:
minDistinct
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The state field path expression- Returns:
- This This builder
-
minus
public T minus(T builder)
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 This builder
-
mod
public T mod(T parameter1, T parameter2)
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 This builder
-
multiply
public T multiply(T builder)
Creates the expressionx * y
.- Specified by:
multiply
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder
- The right side of the multiply expression- Returns:
- This This builder
-
nullIf
public T nullIf(T builder1, T builder2)
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 This builder
-
numeric
public T numeric(Number number)
Creates the numeric literal.- Specified by:
numeric
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
number
- The numeric literal- Returns:
- This This builder
-
numeric
public T numeric(String number)
Creates the numeric literal.- Specified by:
numeric
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
number
- The numeric literal- Returns:
- This This builder
-
parameter
public T parameter(String parameter)
Creates the input parameter.- Specified by:
parameter
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
parameter
- The named or positional input parameter- Returns:
- This This builder
-
path
public T path(String path)
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 This builder
-
plus
public T plus(T builder)
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 This builder
-
size
public T size(String path)
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 This builder
-
sqrt
public T sqrt(T builder)
Creates the expressionSQRT(x)
.- Specified by:
sqrt
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder
- The parameter of theABS
expression- Returns:
- This This builder
-
string
public T string(String literal)
Creates a new string literal.- Specified by:
string
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
literal
- The string literal- Returns:
- This This builder
-
sub
public T sub(T builder)
Creates an encapsulated expression:(expression)
.- Specified by:
sub
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder
- The expression that will be encapsulated- Returns:
- This This builder
-
subtract
public T subtract(T builder)
Creates the expressionx - y
.- Specified by:
subtract
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
builder
- The right side of the addition expression- Returns:
- This This builder
-
sum
public T sum(String path)
Creates the expressionSUM(path)
.- Specified by:
sum
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The state field path expression- Returns:
- This This builder
-
sumDistinct
public T sumDistinct(String path)
Creates the expressionSUM(path)
.- Specified by:
sumDistinct
in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
- Parameters:
path
- The state field path expression- Returns:
- This This builder
-
type
public T type(String path)
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 This builder
-
-