Top Description Inners Fields Constructors Methods
org.hibernate.query.criteria.internal.expression

public Class BinaryArithmeticOperation<N extends java.lang.Number>

extends ExpressionImpl<N extends Number>
implements BinaryOperatorExpression<N extends Number>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.hibernate.query.criteria.internal.expression.BinaryOperatorExpression, javax.persistence.criteria.Expression, javax.persistence.criteria.Selection, javax.persistence.TupleElement
Imports
java.io.Serializable, javax.persistence.criteria.Expression, org.hibernate.query.criteria.internal.CriteriaBuilderImpl, .ParameterRegistry, .Renderable, org.hibernate.query.criteria.internal.compile.RenderingContext, org.hibernate.query.criteria.internal.predicate.ImplicitNumericExpressionTypeDeterminer

Models standard arithmetic operations with two operands.
Author
Steve Ebersole

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private final Expression<? extends N>
private final BinaryArithmeticOperation.Operation
private final Expression<? extends N>

Constructor Summary

AccessConstructor and Description
public
BinaryArithmeticOperation(CriteriaBuilderImpl
The builder for query components.
criteriaBuilder
,
Class<N>
The operation result type
resultType
,
BinaryArithmeticOperation.Operation
The operator (type of operation).
operator
,
Expression<? extends N>
The left-hand operand.
lhs
,
Expression<? extends N>
The right-hand operand
rhs
)

Creates an arithmetic operation based on 2 expressions.

public
BinaryArithmeticOperation(CriteriaBuilderImpl
The builder for query components.
criteriaBuilder
,
Class<N>
The operation result type
javaType
,
BinaryArithmeticOperation.Operation
The operator (type of operation).
operator
,
Expression<? extends N>
The left-hand operand
lhs
,
N
The right-hand operand (the literal)
rhs
)

Creates an arithmetic operation based on an expression and a literal.

public
BinaryArithmeticOperation(CriteriaBuilderImpl
The builder for query components.
criteriaBuilder
,
Class<N>
The operation result type
javaType
,
BinaryArithmeticOperation.Operation
The operator (type of operation).
operator
,
N
The left-hand operand (the literal)
lhs
,
Expression<? extends N>
The right-hand operand
rhs
)

Creates an arithmetic operation based on an expression and a literal.

Method Summary

Modifier and TypeMethod and Description
public static Class<? extends Number>
determineResultType(Class<? extends Number> argument1Type, Class<? extends Number> argument2Type)

public static Class<? extends Number>
determineResultType(Class<? extends Number> argument1Type, Class<? extends Number> argument2Type, boolean isQuotientOperation)

public static Class<? extends Number>

Returns:

The appropriate return type.
determineReturnType
(Class<? extends Number>
The default return type to use if we cannot determine the java type of 'expression' operand.
defaultType
,
Expression<? extends Number>
The operand.
expression
)

Helper for determining the appropriate operation return type based on one of the operands as an expression.

public static Class<? extends Number>

Returns:

The appropriate return type.
determineReturnType
(Class<? extends Number>
The default return type to use if we cannot determine the java type of 'numberLiteral' operand.
defaultType
,
Number
The operand.
numberLiteral
)

Helper for determining the appropriate operation return type based on one of the operands as a literal.

public Expression<? extends N>
public BinaryArithmeticOperation.Operation
public Expression<? extends N>
public void
registerParameters(ParameterRegistry
The parameter registry with which to register.
registry
)

Implements org.hibernate.query.criteria.internal.ParameterContainer.registerParameters.

Register any parameters contained within this query component with the given registry.
public String
render(RenderingContext renderingContext)

Implements org.hibernate.query.criteria.internal.Renderable.render.

Perform the rendering, returning the rendition
Inherited from org.hibernate.query.criteria.internal.expression.ExpressionImpl:
asasBigDecimalasBigIntegerasDoubleasFloatasIntegerasLongasStringininininisNotNullisNull

Field Detail

lhsback to summary
private final Expression<? extends N> lhs
operatorback to summary
private final BinaryArithmeticOperation.Operation operator
rhsback to summary
private final Expression<? extends N> rhs

Constructor Detail

BinaryArithmeticOperationback to summary
public BinaryArithmeticOperation(CriteriaBuilderImpl criteriaBuilder, Class<N> resultType, BinaryArithmeticOperation.Operation operator, Expression<? extends N> lhs, Expression<? extends N> rhs)

Creates an arithmetic operation based on 2 expressions.

Parameters
criteriaBuilder:CriteriaBuilderImpl

The builder for query components.

resultType:Class<N>

The operation result type

operator:BinaryArithmeticOperation.Operation

The operator (type of operation).

lhs:Expression<? extends N>

The left-hand operand.

rhs:Expression<? extends N>

The right-hand operand

BinaryArithmeticOperationback to summary
public BinaryArithmeticOperation(CriteriaBuilderImpl criteriaBuilder, Class<N> javaType, BinaryArithmeticOperation.Operation operator, Expression<? extends N> lhs, N rhs)

Creates an arithmetic operation based on an expression and a literal.

Parameters
criteriaBuilder:CriteriaBuilderImpl

The builder for query components.

javaType:Class<N>

The operation result type

operator:BinaryArithmeticOperation.Operation

The operator (type of operation).

lhs:Expression<? extends N>

The left-hand operand

rhs:N

The right-hand operand (the literal)

BinaryArithmeticOperationback to summary
public BinaryArithmeticOperation(CriteriaBuilderImpl criteriaBuilder, Class<N> javaType, BinaryArithmeticOperation.Operation operator, N lhs, Expression<? extends N> rhs)

Creates an arithmetic operation based on an expression and a literal.

Parameters
criteriaBuilder:CriteriaBuilderImpl

The builder for query components.

javaType:Class<N>

The operation result type

operator:BinaryArithmeticOperation.Operation

The operator (type of operation).

lhs:N

The left-hand operand (the literal)

rhs:Expression<? extends N>

The right-hand operand

Method Detail

determineResultTypeback to summary
public static Class<? extends Number> determineResultType(Class<? extends Number> argument1Type, Class<? extends Number> argument2Type)
determineResultTypeback to summary
public static Class<? extends Number> determineResultType(Class<? extends Number> argument1Type, Class<? extends Number> argument2Type, boolean isQuotientOperation)
determineReturnTypeback to summary
public static Class<? extends Number> determineReturnType(Class<? extends Number> defaultType, Expression<? extends Number> expression)

Helper for determining the appropriate operation return type based on one of the operands as an expression.

Parameters
defaultType:Class<? extends Number>

The default return type to use if we cannot determine the java type of 'expression' operand.

expression:Expression<? extends Number>

The operand.

Returns:Class<? extends Number>

The appropriate return type.

determineReturnTypeback to summary
public static Class<? extends Number> determineReturnType(Class<? extends Number> defaultType, Number numberLiteral)

Helper for determining the appropriate operation return type based on one of the operands as a literal.

Parameters
defaultType:Class<? extends Number>

The default return type to use if we cannot determine the java type of 'numberLiteral' operand.

numberLiteral:Number

The operand.

Returns:Class<? extends Number>

The appropriate return type.

getLeftHandOperandback to summary
public Expression<? extends N> getLeftHandOperand()

Implements org.hibernate.query.criteria.internal.expression.BinaryOperatorExpression.getLeftHandOperand.

Doc from org.hibernate.query.criteria.internal.expression.BinaryOperatorExpression.getLeftHandOperand.

Get the left-hand operand.

Returns:Expression<? extends N>

The left-hand operand.

Annotations
@Override
getOperatorback to summary
public BinaryArithmeticOperation.Operation getOperator()
getRightHandOperandback to summary
public Expression<? extends N> getRightHandOperand()

Implements org.hibernate.query.criteria.internal.expression.BinaryOperatorExpression.getRightHandOperand.

Doc from org.hibernate.query.criteria.internal.expression.BinaryOperatorExpression.getRightHandOperand.

Get the right-hand operand.

Returns:Expression<? extends N>

The right-hand operand.

Annotations
@Override
registerParametersback to summary
public void registerParameters(ParameterRegistry registry)

Implements org.hibernate.query.criteria.internal.ParameterContainer.registerParameters.

Doc from org.hibernate.query.criteria.internal.ParameterContainer.registerParameters.

Register any parameters contained within this query component with the given registry.

Parameters
registry:ParameterRegistry

The parameter registry with which to register.

Annotations
@Override
renderback to summary
public String render(RenderingContext renderingContext)

Implements org.hibernate.query.criteria.internal.Renderable.render.

Doc from org.hibernate.query.criteria.internal.Renderable.render.

Perform the rendering, returning the rendition

Annotations
@Override
org.hibernate.query.criteria.internal.expression back to summary

public sealed Enum BinaryArithmeticOperation.Operation

extends Enum<BinaryArithmeticOperation.Operation>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final BinaryArithmeticOperation.Operation
public static final BinaryArithmeticOperation.Operation
private static final char
public static final BinaryArithmeticOperation.Operation
public static final BinaryArithmeticOperation.Operation
public static final BinaryArithmeticOperation.Operation
private static final char
public static final BinaryArithmeticOperation.Operation

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract String
apply(String lhs, String rhs)

private static String
applyPrimitive(String lhs, char operator, String rhs)

public static BinaryArithmeticOperation.Operation
public static BinaryArithmeticOperation.Operation[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ADDback to summary
public static final BinaryArithmeticOperation.Operation ADD
DIVIDEback to summary
public static final BinaryArithmeticOperation.Operation DIVIDE
LEFT_PARENback to summary
private static final char LEFT_PAREN
MODback to summary
public static final BinaryArithmeticOperation.Operation MOD
MULTIPLYback to summary
public static final BinaryArithmeticOperation.Operation MULTIPLY
QUOTback to summary
public static final BinaryArithmeticOperation.Operation QUOT
RIGHT_PARENback to summary
private static final char RIGHT_PAREN
SUBTRACTback to summary
public static final BinaryArithmeticOperation.Operation SUBTRACT

Constructor Detail

Operationback to summary
private Operation()

Method Detail

applyback to summary
pack-priv abstract String apply(String lhs, String rhs)
applyPrimitiveback to summary
private static String applyPrimitive(String lhs, char operator, String rhs)
valueOfback to summary
public static BinaryArithmeticOperation.Operation valueOf(String name)
valuesback to summary
public static BinaryArithmeticOperation.Operation[] values()