Module jakarta.data

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

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

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

An expression that represents application of a function to zero or more expressions supplied as arguments() to compute a numeric result.

  • Field Details

    • ABS

      static final String ABS

      Name of the function that computes the absolute value of a numeric expression.

      This function accepts a numeric expression as its only argument.

      The result of the ABS function is a numeric expression of the same type as the argument. The resulting expression represents a non-negative numeric value.

      See Also:
    • LENGTH

      static final String LENGTH

      Name of the function that computes the length of a

      Name of the function that computes the length of a textual expression. The length is the number of characters, as determined by the database, in the value to which the textual expression evaluates.

      This function accepts a textual expression as its only argument.

      The result of the LENGTH function is a numeric expression in which the expression type is Integer and the entity type is the same as the entity type of the textual expression. The resulting expression represents a non-negative numeric value, indicating the number of characters in the String value to which the textual expression evaluates.

      See Also:
    • NEG

      static final String NEG

      Name of the function that computes the negation of a numeric expression. This is equivalent to multiplication by -1, causing reversal of the sign on positive numbers to become negative and on negative numbers to become

      Name of the function that computes the additive inverse of a numeric expression. This reverses the sign such that positive numbers become negative and negative numbers become positive.

      This function accepts a numeric expression as its only argument.

      The result of the NEG function is a numeric expression of the same type as the argument.

      See Also:
  • Method Details

    • of

      static <T, N extends Number & Comparable<N>> NumericFunctionExpression<T,N> of(String name, Class<? extends N> returnType, NumericExpression<? super T,N> expression)
      Creates a NumericFunctionExpression to represent a function with the given name that accepts the given numeric expression as input.
      Type Parameters:
      T - entity type.
      N - result type of the function.
      Parameters:
      name - a function name constant (such as ABS) defined in this class or a function name constant from a vendor extension.
      returnType - the type of the result to which the expression evaluates.
      expression - an expression that evaluates to a numeric value.
      Returns:
      a NumericFunctionExpression representing the function.
    • of

      static <T, N extends Number & Comparable<N>> NumericFunctionExpression<T,N> of(String name, Class<N> returnType, TextExpression<? super T> expression)
      Creates a NumericFunctionExpression to represent a function with the given name that accepts the given textual expression as input.
      Type Parameters:
      T - entity type.
      N - result type of the function.
      Parameters:
      name - a function name constant (such as LENGTH) defined in this class or a function name constant from a vendor extension.
      returnType - the type of the result to which the expression evaluates.
      expression - an expression that evaluates to a String value.
      Returns:
      a NumericFunctionExpression representing the function.
    • arguments

      List<? extends ComparableExpression<? super T,?>> arguments()

      An ordered list of inputs to the function.

      A constant (such as ABS or LENGTH defined in this class or in a vendor extension) defines the function name and is also responsible for documenting the function arguments, including the meaning and data type of each argument and the order in which arguments must be supplied. By convention, when a method of an Expression subtype represents invocation of a function on a target expression, such as NumericExpression.abs(), the first element of the argument list should be the target expression, and subsequent elements should be the method arguments, in the same order, if present.

      Specified by:
      arguments in interface FunctionExpression<T,N extends Number & Comparable<N>>
      Returns:
      a list of expressions that represent the arguments to the function.