EclipseLink 2.4.2, build 'v20130514-5956486' API Reference

org.eclipse.persistence.jpa.jpql.model
Class AbstractScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>

java.lang.Object
  extended by org.eclipse.persistence.jpa.jpql.model.AbstractStateObjectBuilder
      extended by org.eclipse.persistence.jpa.jpql.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.

Version:
2.4
Author:
Pascal Filion
Since:
2.4

Constructor Summary
protected AbstractScalarExpressionStateObjectBuilder(StateObject parent)
          Creates a new AbstractScalarExpressionStateObjectBuilder.
 
Method Summary
 T abs(T builder)
          Creates the expression ABS(x).
 T add(T builder)
          Creates the expression x + y.
protected  void arithmetic(boolean plusSign)
           
protected  void avg(boolean distinct, java.lang.String path)
           
 T avg(java.lang.String path)
          Creates the expression AVG(path).
 T avgDistinct(java.lang.String path)
          Creates the expression AVG(DISTINCT path).
protected  StateObject buildCollectionPath(java.lang.String path)
           
protected  StateObject buildIdentificationVariable(java.lang.String literal)
           
protected  StateObject buildInputParameter(java.lang.String parameter)
           
protected  StateObject buildNumeric(java.lang.Number number)
           
protected  StateObject buildNumeric(java.lang.String number)
           
protected  StateObject buildStateFieldPath(java.lang.String path)
           
protected  StateObject buildStringLiteral(java.lang.String literal)
           
 T case_(ICaseExpressionStateObjectBuilder builder)
          Creates a new CASE expression.
 T coalesce(T builder1, T builder2, T... builders)
          Create the expression COALESCE(scalar_expression {, scalar_expression}+).
 T concat(T builder1, T builder2, T... builders)
          Creates the expression CONCAT(string_primary, string_primary {, string_primary}*).
protected  void count(boolean distinct, java.lang.String path)
           
 T count(java.lang.String path)
          Creates the expression COUNT(identification_variable | state_field_path_expression | single_valued_object_path_expression).
 T countDistinct(java.lang.String path)
          Creates the expression COUNT(DISTINCT identification_variable | state_field_path_expression | single_valued_object_path_expression).
 T currentDate()
          Creates the expression representing CURRENT_DATE.
 T currentTime()
          Creates the expression representing CURRENT_TIME.
 T currentTimestamp()
          Creates the expression representing CURRENT_TIMESTAMP.
 T date(java.lang.String jdbcDate)
          Creates a new date using the JDBC syntax of a date.
 T divide(T builder)
          Creates the expression x ÷ y.
 T entityType(java.lang.String entityTypeName)
          Creates a new entity type literal.
 T enumLiteral(java.lang.Enum<? extends java.lang.Enum<?>> enumConstant)
          Creates a new enum literal.
 T function(java.lang.String identifier, java.lang.String functionName, java.lang.String... arguments)
          Creates the expression <identifier>('functionName' {, expression}*).
 T function(java.lang.String identifier, java.lang.String functionName, T... arguments)
          Creates the expression <identifier>('functionName' {, expression}*).
 ICaseExpressionStateObjectBuilder getCaseBuilder()
          Returns the builder that can create a CASE expression, which requires a IConditionalExpressionStateObjectBuilder to build the WHEN clauses.
protected  StateObject getParent()
          Returns the parent of the expression to build, which is only required when a JPQL fragment needs to be parsed.
 T index(java.lang.String variable)
          Creates the expression INDEX(identification_variable).
 T length(T builder)
          Creates the expression LENGTH(expression).
protected  StateObject literal(java.lang.String literal)
           
protected  java.util.List<StateObject> literals(java.lang.String... literals)
           
 T locate(T parameter1, T parameter2)
          Creates the expression LOCATE(string_primary, string_primary).
 T locate(T parameter1, T parameter2, T parameter3)
          Creates the expression LOCATE(string_primary, string_primary [, simple_arithmetic_expression]).
protected  void max(boolean distinct, java.lang.String path)
           
 T max(java.lang.String path)
          Creates the expression MAX(path).
 T maxDistinct(java.lang.String path)
          Creates the expression MAX(DISTINCT path).
protected  void min(boolean distinct, java.lang.String path)
           
 T min(java.lang.String path)
          Creates the expression AVG(path).
 T minDistinct(java.lang.String path)
          Creates the expression AVG(DISTINCT path).
 T minus(T builder)
          Creates the expression - x.
 T mod(T parameter1, T parameter2)
          Creates the expression MOD(simple_arithmetic_expression, simple_arithmetic_expression).
 T multiply(T builder)
          Creates the expression x × y.
 T nullIf(T builder1, T builder2)
          Create the expression NULLIF(scalar_expression, scalar_expression).
 T numeric(java.lang.Number number)
          Creates the numeric literal.
 T numeric(java.lang.String number)
          Creates the numeric literal.
 T parameter(java.lang.String parameter)
          Creates the input parameter.
 T path(java.lang.String path)
          Creates a new state field path expression.
 T plus(T builder)
          Creates the expression + x.
 T size(java.lang.String path)
          Creates the expression SIZE(collection_valued_path_expression).
 T sqrt(T builder)
          Creates the expression SQRT(x).
protected  java.util.List<StateObject> stateObjects(int count)
          Returns a list of the StateObjects that were previously created.
protected  java.util.List<StateObject> stateObjects(T... builders)
          Returns a list of the StateObjects that were previously created.
 T string(java.lang.String literal)
          Creates a new string literal.
 T sub(T builder)
          Creates an encapsulated expression: (expression).
 T subtract(T builder)
          Creates the expression x - y.
protected  void sum(boolean distinct, java.lang.String path)
           
 T sum(java.lang.String path)
          Creates the expression SUM(path).
 T sumDistinct(java.lang.String path)
          Creates the expression SUM(path).
 T type(java.lang.String path)
          Creates the expression TYPE(identification_variable | single_valued_object_path_expression | input_parameter).
 
Methods inherited from class org.eclipse.persistence.jpa.jpql.model.AbstractStateObjectBuilder
add, checkBuilder, checkBuilders, hasStateObjects, pop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractScalarExpressionStateObjectBuilder

protected AbstractScalarExpressionStateObjectBuilder(StateObject parent)
Creates a new AbstractScalarExpressionStateObjectBuilder.

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 expression ABS(x).

Specified by:
abs in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Parameters:
builder - The parameter of the ABS expression
Returns:
This This builder

add

public T add(T builder)
Creates the expression x + y.

Specified by:
add in interface IScalarExpressionStateObjectBuilder<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 expression AVG(path).

Specified by:
avg in interface IScalarExpressionStateObjectBuilder<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 expression AVG(DISTINCT path).

Specified by:
avgDistinct in interface IScalarExpressionStateObjectBuilder<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 new CASE expression.

Specified by:
case_ in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Parameters:
builder - The builder of a CASE expression
Returns:
This This builder

coalesce

public T coalesce(T builder1,
                  T builder2,
                  T... builders)
Create the expression COALESCE(scalar_expression {, scalar_expression}+).

Specified by:
coalesce in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Parameters:
builder1 - The first scalar expression
builder2 - The second scalar expression
builders - The subsequent scalar expressions
Returns:
This This builder

concat

public T concat(T builder1,
                T builder2,
                T... builders)
Creates the expression CONCAT(string_primary, string_primary {, string_primary}*).

Specified by:
concat in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Parameters:
builder1 - The first argument of the expression
builder2 - The second argument of the expression
builders - 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 expression COUNT(identification_variable | state_field_path_expression | single_valued_object_path_expression).

Specified by:
count in interface IScalarExpressionStateObjectBuilder<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 expression COUNT(DISTINCT identification_variable | state_field_path_expression | single_valued_object_path_expression).

Specified by:
countDistinct in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Parameters:
path - The state field path expression
Returns:
This This builder

currentDate

public T currentDate()
Creates the expression representing CURRENT_DATE.

Specified by:
currentDate in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Returns:
This This builder

currentTime

public T currentTime()
Creates the expression representing CURRENT_TIME.

Specified by:
currentTime in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Returns:
This This builder

currentTimestamp

public T currentTimestamp()
Creates the expression representing CURRENT_TIMESTAMP.

Specified by:
currentTimestamp in interface IScalarExpressionStateObjectBuilder<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:
date in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Returns:
This This builder

divide

public T divide(T builder)
Creates the expression x ÷ y.

Specified by:
divide in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Parameters:
builder - The right side of the addition expression
Returns:
This This builder

entityType

public T entityType(java.lang.String entityTypeName)
Creates a new entity type literal.

Specified by:
entityType in interface IScalarExpressionStateObjectBuilder<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:
enumLiteral in interface IScalarExpressionStateObjectBuilder<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:
function in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Parameters:
identifier - The JPQL identifier that is used to identify the SQL expression
functionName - The name of the native SQL function
arguments - 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:
function in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Parameters:
identifier - The JPQL identifier that is used to identify the SQL expression
functionName - The name of the native SQL function
arguments - The arguments of the expression
Returns:
This builder

getCaseBuilder

public ICaseExpressionStateObjectBuilder getCaseBuilder()
Returns the builder that can create a CASE expression, which requires a IConditionalExpressionStateObjectBuilder to build the WHEN clauses.

Specified by:
getCaseBuilder in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Returns:
The builder of a CASE expression

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 expression INDEX(identification_variable).

Specified by:
index in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Parameters:
variable - The identification variable
Returns:
This This builder

length

public T length(T builder)
Creates the expression LENGTH(expression).

Specified by:
length in interface IScalarExpressionStateObjectBuilder<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 expression LOCATE(string_primary, string_primary).

Specified by:
locate in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Parameters:
parameter1 - The first string primary
parameter2 - The second string primary
Returns:
This This builder

locate

public T locate(T parameter1,
                T parameter2,
                T parameter3)
Creates the expression LOCATE(string_primary, string_primary [, simple_arithmetic_expression]).

Specified by:
locate in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Parameters:
parameter1 - The first string primary
parameter2 - The second string primary
parameter3 - 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 expression MAX(path).

Specified by:
max in interface IScalarExpressionStateObjectBuilder<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 expression MAX(DISTINCT path).

Specified by:
maxDistinct in interface IScalarExpressionStateObjectBuilder<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 expression AVG(path).

Specified by:
min in interface IScalarExpressionStateObjectBuilder<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 expression AVG(DISTINCT path).

Specified by:
minDistinct in interface IScalarExpressionStateObjectBuilder<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 interface IScalarExpressionStateObjectBuilder<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 expression MOD(simple_arithmetic_expression, simple_arithmetic_expression).

Specified by:
mod in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Parameters:
parameter1 - The first parameter
parameter2 - The second parameter
Returns:
This This builder

multiply

public T multiply(T builder)
Creates the expression x × y.

Specified by:
multiply in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Parameters:
builder - The right side of the addition expression
Returns:
This This builder

nullIf

public T nullIf(T builder1,
                T builder2)
Create the expression NULLIF(scalar_expression, scalar_expression).

Specified by:
nullIf in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Parameters:
builder1 - The first scalar expression
builder2 - The second scalar expression
Returns:
This This builder

numeric

public T numeric(java.lang.Number number)
Creates the numeric literal.

Specified by:
numeric in interface IScalarExpressionStateObjectBuilder<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:
numeric in interface IScalarExpressionStateObjectBuilder<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:
parameter in interface IScalarExpressionStateObjectBuilder<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:
path in interface IScalarExpressionStateObjectBuilder<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 interface IScalarExpressionStateObjectBuilder<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 expression SIZE(collection_valued_path_expression).

Specified by:
size in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Parameters:
path - The collection-valued path expression
Returns:
This This builder

sqrt

public T sqrt(T builder)
Creates the expression SQRT(x).

Specified by:
sqrt in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Parameters:
builder - The parameter of the ABS expression
Returns:
This This builder

stateObjects

protected java.util.List<StateObject> stateObjects(int count)
Returns a list of the StateObjects that were previously created.

Parameters:
count - The number of StateObjects to move to the list
Returns:
The list of StateObjects that were added to the stack

stateObjects

protected java.util.List<StateObject> stateObjects(T... builders)
Returns a list of the StateObjects that were previously created.

Parameters:
builders - The list of builders is used to determine how many StateObjects needs to be pulled out of the stack
Returns:
The list of StateObjects that were added to the stack

string

public T string(java.lang.String literal)
Creates a new string literal.

Specified by:
string in interface IScalarExpressionStateObjectBuilder<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 interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Parameters:
builder - The expression that will be encapsulated
Returns:
This This builder

subtract

public T subtract(T builder)
Creates the expression x - y.

Specified by:
subtract in interface IScalarExpressionStateObjectBuilder<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 expression SUM(path).

Specified by:
sum in interface IScalarExpressionStateObjectBuilder<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 expression SUM(path).

Specified by:
sumDistinct in interface IScalarExpressionStateObjectBuilder<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 expression TYPE(identification_variable | single_valued_object_path_expression | input_parameter).

Specified by:
type in interface IScalarExpressionStateObjectBuilder<T extends IScalarExpressionStateObjectBuilder<T>>
Parameters:
path - The identification variable or the input parameter
Returns:
This This builder

EclipseLink 2.4.2, build 'v20130514-5956486' API Reference