Class NumericResolver


  • public class NumericResolver
    extends Resolver
    This Resolver is responsible to return the numeric type for a list of Resolvers.

    The result of a CASE expression, COALESCE expression, NULLIF expression, or arithmetic expression (+, -, *, /) is determined by applying the following rule to its operands.

    • If there is an operand of type Double or double, the result of the operation is of type Double;
    • otherwise, if there is an operand of type Float or float, the result of the operation is of type Float;
    • otherwise, if there is an operand of type BigDecimal, the result of the operation is of type BigDecimal;
    • otherwise, if there is an operand of type BigInteger, the result of the operation is of type BigInteger, unless the operator is / (division), in which case the numeric result type is not further defined;
    • otherwise, if there is an operand of type Long or long, the result of the operation is of type Long, unless the operator is / (division), in which case the numeric result type is not further defined;
    • otherwise, if there is an operand of integral type, the result of the operation is of type Integer, unless the operator is / (division), in which case the numeric result type is not further defined.
    Since:
    2.3
    Version:
    2.5
    Author:
    Pascal Filion
    • Constructor Detail

      • NumericResolver

        public NumericResolver​(Resolver parent,
                               java.util.Collection<Resolver> typeResolvers)
        Creates a new NumericResolver.
        Parameters:
        parent - The parent Resolver, which is never null
        typeResolvers - The resolvers used to calculate the numeric type
      • NumericResolver

        public NumericResolver​(Resolver parent,
                               Resolver resolver)
        Creates a new NumericResolver.
        Parameters:
        parent - The parent Resolver, which is never null
        resolver - The Resolver used to calculate the numeric type