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.- Version:
- 2.4
- Author:
- Pascal Filion
- Since:
- 2.4
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractScalarExpressionStateObjectBuilder(StateObject parent)Creates a newAbstractScalarExpressionStateObjectBuilder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tabs(T builder)Creates the expressionABS(x).Tadd(T builder)Creates the expressionx + y.protected voidarithmetic(boolean plusSign)protected voidavg(boolean distinct, java.lang.String path)Tavg(java.lang.String path)Creates the expressionAVG(path).TavgDistinct(java.lang.String path)Creates the expressionAVG(DISTINCT path).protected StateObjectbuildCollectionPath(java.lang.String path)protected StateObjectbuildIdentificationVariable(java.lang.String literal)protected StateObjectbuildInputParameter(java.lang.String parameter)protected StateObjectbuildNumeric(java.lang.Number number)protected StateObjectbuildNumeric(java.lang.String number)protected StateObjectbuildStateFieldPath(java.lang.String path)protected StateObjectbuildStringLiteral(java.lang.String literal)Tcase_(ICaseExpressionStateObjectBuilder builder)Creates a newCASEexpression.Tcoalesce(T builder1, T builder2, T... builders)Create the expressionCOALESCE(scalar_expression {, scalar_expression}+).Tconcat(T builder1, T builder2, T... builders)Creates the expressionCONCAT(string_primary, string_primary {, string_primary}*).protected voidcount(boolean distinct, java.lang.String path)Tcount(java.lang.String path)Creates the expressionCOUNT(identification_variable | state_field_path_expression | single_valued_object_path_expression).TcountDistinct(java.lang.String path)Creates the expressionCOUNT(DISTINCT identification_variable | state_field_path_expression | single_valued_object_path_expression).TcurrentDate()Creates the expression representingCURRENT_DATE.TcurrentTime()Creates the expression representingCURRENT_TIME.TcurrentTimestamp()Creates the expression representingCURRENT_TIMESTAMP.Tdate(java.lang.String jdbcDate)Creates a new date using the JDBC syntax of a date.Tdivide(T builder)Creates the expressionx / y.TentityType(java.lang.String entityTypeName)Creates a new entity type literal.TenumLiteral(java.lang.Enum<? extends java.lang.Enum<?>> enumConstant)Creates a new enum literal.Tfunction(java.lang.String identifier, java.lang.String functionName, java.lang.String... arguments)Creates the expression<identifier>('functionName' {, expression}*).Tfunction(java.lang.String identifier, java.lang.String functionName, T... arguments)Creates the expression<identifier>('functionName' {, expression}*).ICaseExpressionStateObjectBuildergetCaseBuilder()Returns the builder that can create aCASEexpression, which requires aIConditionalExpressionStateObjectBuilderto build theWHENclauses.protected StateObjectgetParent()Returns the parent of the expression to build, which is only required when a JPQL fragment needs to be parsed.Tindex(java.lang.String variable)Creates the expressionINDEX(identification_variable).Tlength(T builder)Creates the expressionLENGTH(expression).protected StateObjectliteral(java.lang.String literal)protected java.util.List<StateObject>literals(java.lang.String... literals)Tlocate(T parameter1, T parameter2)Creates the expressionLOCATE(string_primary, string_primary).Tlocate(T parameter1, T parameter2, T parameter3)Creates the expressionLOCATE(string_primary, string_primary [, simple_arithmetic_expression]).protected voidmax(boolean distinct, java.lang.String path)Tmax(java.lang.String path)Creates the expressionMAX(path).TmaxDistinct(java.lang.String path)Creates the expressionMAX(DISTINCT path).protected voidmin(boolean distinct, java.lang.String path)Tmin(java.lang.String path)Creates the expressionAVG(path).TminDistinct(java.lang.String path)Creates the expressionAVG(DISTINCT path).Tminus(T builder)Creates the expression- x.Tmod(T parameter1, T parameter2)Creates the expressionMOD(simple_arithmetic_expression, simple_arithmetic_expression).Tmultiply(T builder)Creates the expressionx * y.TnullIf(T builder1, T builder2)Create the expressionNULLIF(scalar_expression, scalar_expression).Tnumeric(java.lang.Number number)Creates the numeric literal.Tnumeric(java.lang.String number)Creates the numeric literal.Tparameter(java.lang.String parameter)Creates the input parameter.Tpath(java.lang.String path)Creates a new state field path expression.Tplus(T builder)Creates the expression+ x.Tsize(java.lang.String path)Creates the expressionSIZE(collection_valued_path_expression).Tsqrt(T builder)Creates the expressionSQRT(x).protected java.util.List<StateObject>stateObjects(int count)Returns a list of theStateObjectsthat were previously created.protected java.util.List<StateObject>stateObjects(T... builders)Returns a list of theStateObjectsthat were previously created.Tstring(java.lang.String literal)Creates a new string literal.Tsub(T builder)Creates an encapsulated expression:(expression).Tsubtract(T builder)Creates the expressionx - y.protected voidsum(boolean distinct, java.lang.String path)Tsum(java.lang.String path)Creates the expressionSUM(path).TsumDistinct(java.lang.String path)Creates the expressionSUM(path).Ttype(java.lang.String 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 Detail
-
AbstractScalarExpressionStateObjectBuilder
protected AbstractScalarExpressionStateObjectBuilder(StateObject parent)
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 Detail
-
abs
public T abs(T builder)
Creates the expressionABS(x).- Specified by:
absin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
builder- The parameter of theABSexpression- Returns:
- This This builder
-
add
public T add(T builder)
Creates the expressionx + y.- Specified by:
addin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
builder- The right side of the addition expression- Returns:
- This builder
-
arithmetic
protected void arithmetic(boolean plusSign)
-
avg
protected void avg(boolean distinct, java.lang.String path)
-
avg
public T avg(java.lang.String path)
Creates the expressionAVG(path).- Specified by:
avgin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
path- The state field path expression- Returns:
- This This builder
-
avgDistinct
public T avgDistinct(java.lang.String path)
Creates the expressionAVG(DISTINCT path).- Specified by:
avgDistinctin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
path- The state field path expression- Returns:
- This This builder
-
buildCollectionPath
protected StateObject buildCollectionPath(java.lang.String path)
-
buildIdentificationVariable
protected StateObject buildIdentificationVariable(java.lang.String literal)
-
buildInputParameter
protected StateObject buildInputParameter(java.lang.String parameter)
-
buildNumeric
protected StateObject buildNumeric(java.lang.Number number)
-
buildNumeric
protected StateObject buildNumeric(java.lang.String number)
-
buildStateFieldPath
protected StateObject buildStateFieldPath(java.lang.String path)
-
buildStringLiteral
protected StateObject buildStringLiteral(java.lang.String literal)
-
case_
public T case_(ICaseExpressionStateObjectBuilder builder)
Creates a newCASEexpression.- Specified by:
case_in interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
builder- Thebuilderof aCASEexpression- Returns:
- This This builder
-
coalesce
public T coalesce(T builder1, T builder2, T... builders)
Create the expressionCOALESCE(scalar_expression {, scalar_expression}+).- Specified by:
coalescein 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:
concatin 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
protected void count(boolean distinct, java.lang.String path)
-
count
public T count(java.lang.String path)
Creates the expressionCOUNT(identification_variable | state_field_path_expression | single_valued_object_path_expression).- Specified by:
countin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
path- The state field path expression- Returns:
- This This builder
-
countDistinct
public T countDistinct(java.lang.String path)
Creates the expressionCOUNT(DISTINCT identification_variable | state_field_path_expression | single_valued_object_path_expression).- Specified by:
countDistinctin 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:
currentDatein interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Returns:
- This This builder
-
currentTime
public T currentTime()
Creates the expression representingCURRENT_TIME.- Specified by:
currentTimein interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Returns:
- This This builder
-
currentTimestamp
public T currentTimestamp()
Creates the expression representingCURRENT_TIMESTAMP.- Specified by:
currentTimestampin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Returns:
- This This builder
-
date
public T date(java.lang.String jdbcDate)
Creates a new date using the JDBC syntax of a date.- Specified by:
datein interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Returns:
- This This builder
-
divide
public T divide(T builder)
Creates the expressionx / y.- Specified by:
dividein interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
builder- The right side of the division expression- Returns:
- This This builder
-
entityType
public T entityType(java.lang.String entityTypeName)
Creates a new entity type literal.- Specified by:
entityTypein interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
entityTypeName- The short name of the entity- Returns:
- This This builder
-
enumLiteral
public T enumLiteral(java.lang.Enum<? extends java.lang.Enum<?>> enumConstant)
Creates a new enum literal.- Specified by:
enumLiteralin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
enumConstant- The enum constant- Returns:
- This This builder
-
function
public T function(java.lang.String identifier, java.lang.String functionName, java.lang.String... arguments)
Creates the expression<identifier>('functionName' {, expression}*).- Specified by:
functionin 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(java.lang.String identifier, java.lang.String functionName, T... arguments)
Creates the expression<identifier>('functionName' {, expression}*).- Specified by:
functionin 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 aCASEexpression, which requires aIConditionalExpressionStateObjectBuilderto build theWHENclauses.- Specified by:
getCaseBuilderin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Returns:
- The builder of a
CASEexpression
-
getParent
protected StateObject 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
public T index(java.lang.String variable)
Creates the expressionINDEX(identification_variable).- Specified by:
indexin 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:
lengthin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
builder- The encapsulated expression- Returns:
- This This builder
-
literal
protected StateObject literal(java.lang.String literal)
-
literals
protected java.util.List<StateObject> literals(java.lang.String... literals)
-
locate
public T locate(T parameter1, T parameter2)
Creates the expressionLOCATE(string_primary, string_primary).- Specified by:
locatein 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:
locatein 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
protected void max(boolean distinct, java.lang.String path)
-
max
public T max(java.lang.String path)
Creates the expressionMAX(path).- Specified by:
maxin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
path- The state field path expression- Returns:
- This This builder
-
maxDistinct
public T maxDistinct(java.lang.String path)
Creates the expressionMAX(DISTINCT path).- Specified by:
maxDistinctin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
path- The state field path expression- Returns:
- This This builder
-
min
protected void min(boolean distinct, java.lang.String path)
-
min
public T min(java.lang.String path)
Creates the expressionAVG(path).- Specified by:
minin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
path- The state field path expression- Returns:
- This This builder
-
minDistinct
public T minDistinct(java.lang.String path)
Creates the expressionAVG(DISTINCT path).- Specified by:
minDistinctin 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:
minusin 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:
modin 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:
multiplyin 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:
nullIfin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
builder1- The first scalar expressionbuilder2- The second scalar expression- Returns:
- This This builder
-
numeric
public T numeric(java.lang.Number number)
Creates the numeric literal.- Specified by:
numericin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
number- The numeric literal- Returns:
- This This builder
-
numeric
public T numeric(java.lang.String number)
Creates the numeric literal.- Specified by:
numericin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
number- The numeric literal- Returns:
- This This builder
-
parameter
public T parameter(java.lang.String parameter)
Creates the input parameter.- Specified by:
parameterin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
parameter- The named or positional input parameter- Returns:
- This This builder
-
path
public T path(java.lang.String path)
Creates a new state field path expression.- Specified by:
pathin 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:
plusin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
builder- The expression that will have the plus sign prepended- Returns:
- This This builder
-
size
public T size(java.lang.String path)
Creates the expressionSIZE(collection_valued_path_expression).- Specified by:
sizein 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:
sqrtin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
builder- The parameter of theABSexpression- Returns:
- This This builder
-
stateObjects
protected java.util.List<StateObject> stateObjects(int count)
Returns a list of theStateObjectsthat were previously created.- Parameters:
count- The number ofStateObjectsto move to the list- Returns:
- The list of
StateObjectsthat were added to the stack
-
stateObjects
protected java.util.List<StateObject> stateObjects(T... builders)
Returns a list of theStateObjectsthat were previously created.- Parameters:
builders- The list ofbuildersis used to determine how manyStateObjectsneeds to be pulled out of the stack- Returns:
- The list of
StateObjectsthat were added to the stack
-
string
public T string(java.lang.String literal)
Creates a new string literal.- Specified by:
stringin 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:
subin 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:
subtractin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
builder- The right side of the addition expression- Returns:
- This This builder
-
sum
protected void sum(boolean distinct, java.lang.String path)
-
sum
public T sum(java.lang.String path)
Creates the expressionSUM(path).- Specified by:
sumin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
path- The state field path expression- Returns:
- This This builder
-
sumDistinct
public T sumDistinct(java.lang.String path)
Creates the expressionSUM(path).- Specified by:
sumDistinctin interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
path- The state field path expression- Returns:
- This This builder
-
type
public T type(java.lang.String path)
Creates the expressionTYPE(identification_variable | single_valued_object_path_expression | input_parameter).- Specified by:
typein interfaceIScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>- Parameters:
path- The identification variable or the input parameter- Returns:
- This This builder
-
-