org.hibernate.ejb.criteria.expression
Class BinaryArithmeticOperation<N extends Number>
java.lang.Object
org.hibernate.ejb.criteria.AbstractNode
org.hibernate.ejb.criteria.expression.AbstractTupleElement<X>
org.hibernate.ejb.criteria.expression.SelectionImpl<T>
org.hibernate.ejb.criteria.expression.ExpressionImpl<N>
org.hibernate.ejb.criteria.expression.BinaryArithmeticOperation<N>
- All Implemented Interfaces:
- Serializable, Expression<N>, Selection<N>, TupleElement<N>, BinaryOperatorExpression<N>, ExpressionImplementor<N>, ParameterContainer, Renderable, SelectionImplementor<N>, TupleElementImplementor<N>
public class BinaryArithmeticOperation<N extends Number>
- extends ExpressionImpl<N>
- implements BinaryOperatorExpression<N>, Serializable
Models standard arithmetc operations with two operands.
- See Also:
- Serialized Form
Constructor Summary |
BinaryArithmeticOperation(CriteriaBuilderImpl criteriaBuilder,
Class<N> resultType,
BinaryArithmeticOperation.Operation operator,
Expression<? extends N> lhs,
Expression<? extends N> rhs)
Creates an arithmethic operation based on 2 expressions. |
BinaryArithmeticOperation(CriteriaBuilderImpl criteriaBuilder,
Class<N> javaType,
BinaryArithmeticOperation.Operation operator,
Expression<? extends N> lhs,
N rhs)
Creates an arithmethic operation based on an expression and a literal. |
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. |
Methods inherited from class org.hibernate.ejb.criteria.expression.ExpressionImpl |
as, asBigDecimal, asBigInteger, asDouble, asFloat, asInteger, asLong, asString, in, in, in, in, isNotNull, isNull |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BinaryArithmeticOperation
public BinaryArithmeticOperation(CriteriaBuilderImpl criteriaBuilder,
Class<N> resultType,
BinaryArithmeticOperation.Operation operator,
Expression<? extends N> lhs,
Expression<? extends N> rhs)
- Creates an arithmethic operation based on 2 expressions.
- Parameters:
criteriaBuilder
- The builder for query components.resultType
- The operation result typeoperator
- The operator (type of operation).lhs
- The left-hand operand.rhs
- The right-hand operand
BinaryArithmeticOperation
public BinaryArithmeticOperation(CriteriaBuilderImpl criteriaBuilder,
Class<N> javaType,
BinaryArithmeticOperation.Operation operator,
Expression<? extends N> lhs,
N rhs)
- Creates an arithmethic operation based on an expression and a literal.
- Parameters:
criteriaBuilder
- The builder for query components.javaType
- The operation result typeoperator
- The operator (type of operation).lhs
- The left-hand operandrhs
- The right-hand operand (the literal)
BinaryArithmeticOperation
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
- The builder for query components.javaType
- The operation result typeoperator
- The operator (type of operation).lhs
- The left-hand operand (the literal)rhs
- The right-hand operand
determineResultType
public static Class<? extends Number> determineResultType(Class<? extends Number> argument1Type,
Class<? extends Number> argument2Type)
determineResultType
public static Class<? extends Number> determineResultType(Class<? extends Number> argument1Type,
Class<? extends Number> argument2Type,
boolean isQuotientOperation)
determineReturnType
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
- The default return type to use if we cannot determine the java type of 'expression' operand.expression
- The operand.
- Returns:
- The appropriate return type.
determineReturnType
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
- The default return type to use if we cannot determine the java type of 'numberLiteral' operand.numberLiteral
- The operand.
- Returns:
- The appropriate return type.
getOperator
public BinaryArithmeticOperation.Operation getOperator()
getRightHandOperand
public Expression<? extends N> getRightHandOperand()
- Get the right-hand operand.
- Specified by:
getRightHandOperand
in interface BinaryOperatorExpression<N extends Number>
- Returns:
- The right-hand operand.
getLeftHandOperand
public Expression<? extends N> getLeftHandOperand()
- Get the left-hand operand.
- Specified by:
getLeftHandOperand
in interface BinaryOperatorExpression<N extends Number>
- Returns:
- The left-hand operand.
registerParameters
public void registerParameters(ParameterRegistry registry)
- Register any parameters contained within this query component with the given registry.
- Specified by:
registerParameters
in interface ParameterContainer
- Parameters:
registry
- The parameter registry with which to register.
render
public String render(CriteriaQueryCompiler.RenderingContext renderingContext)
- Specified by:
render
in interface Renderable
renderProjection
public String renderProjection(CriteriaQueryCompiler.RenderingContext renderingContext)
- Specified by:
renderProjection
in interface Renderable
Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.