Module jakarta.data

Interface NumericOperatorExpression<T,N extends Number & Comparable<N>>

Type Parameters:
T - entity type.
N - result type of the numeric expression.
All Superinterfaces:
ComparableExpression<T,N>, Expression<T,N>, NumericExpression<T,N>

public interface NumericOperatorExpression<T,N extends Number & Comparable<N>> extends NumericExpression<T,N>

A numeric expression that represents a binary operation, such as the addition or multiplication of two numeric expressions.

Since:
1.1
  • Method Details

    • left

      NumericExpression<? super T,N> left()

      The numeric expression to which the arithmetic operator() is applied.

      For example, the left expression is the minuend when the operation is subtraction,

      difference = left() - right()

      The left expression is the dividend when the operation is division,

      quotient = left() / right()
      Returns:
      the numeric expression to which the operator is applied.
    • operator

      The type of arithmetic operation represented by this expression.

      Returns:
      one of the enumerated Operator values.
    • right

      NumericExpression<? super T,N> right()

      The numeric expression applied to the left() expression by the arithmetic operator().

      For example, the right expression is the subtrahend when the operation is subtraction,

      difference = left() - right()

      The right expression is the divisor when the operation is division,

      quotient = left() / right()
      Returns:
      the numeric expression applied to the left() expression by the arithmetic operator.
    • of

      static <T, N extends Number & Comparable<N>> NumericOperatorExpression<T,N> of(NumericOperatorExpression.Operator operator, N left, NumericExpression<T,N> right)

      Creates a NumericOperatorExpression that represents the given arithmetic operator applying the value represented by the right expression to the given left value.

      Type Parameters:
      T - entity type.
      N - type of the left value, right expression, and result expression.
      Parameters:
      operator - one of the enumerated Operator values.
      left - value to which the operator is applied.
      right - expression that represents the value applied by the operator to the left value.
      Returns:
      a numeric expression representing the result of the operation.
      Throws:
      NullPointerException - if any of the method arguments are null.
    • of

      static <T, N extends Number & Comparable<N>> NumericOperatorExpression<T,N> of(NumericOperatorExpression.Operator operator, NumericExpression<T,N> left, N right)

      Creates a NumericOperatorExpression that represents the given arithmetic operator applying the given right value to the value represented by the left expression.

      Type Parameters:
      T - entity type.
      N - type of the left expression, right value, and result expression.
      Parameters:
      operator - one of the enumerated Operator values.
      left - expression to which the operator is applied.
      right - value applied by the operator to the left expression.
      Returns:
      a numeric expression representing the result of the operation.
      Throws:
      NullPointerException - if any of the method arguments are null.
    • of

      static <T, N extends Number & Comparable<N>> NumericOperatorExpression<T,N> of(NumericOperatorExpression.Operator operator, NumericExpression<T,N> left, NumericExpression<? super T,N> right)

      Creates a NumericOperatorExpression that represents the given arithmetic operator applying the value represented by the right expression to the value represented by the left expression.

      Type Parameters:
      T - entity type.
      N - type of the left expression, right expression, and result expression.
      Parameters:
      operator - one of the enumerated Operator values.
      left - expression to which the operator is applied.
      right - expression that represents the value applied by the operator to the left expression.
      Returns:
      a numeric expression representing the result of the operation.
      Throws:
      NullPointerException - if any of the method arguments are null.