Class InvalidOperandTypeException

  • All Implemented Interfaces:
    Serializable

    public class InvalidOperandTypeException
    extends DRException
    An exception indicating the data type of a subexpression is not valid for use in the containing expression.

    These errors are typically raised at one of two times:

    • During definition of a function instance, when it is determined that upper bounds on the expression cannot satisfy requirements.
    • When constructing an evaluator in the context of a record schema and the subexpression fails to satisfy requirements.
    See Also:
    Serialized Form
    • Constructor Detail

      • InvalidOperandTypeException

        public InvalidOperandTypeException​(String reason)
        Declares an exception occurred for the specified reason. No type requirement is provided with the error.
        Parameters:
        reason - an explanation of the cause of the error
      • InvalidOperandTypeException

        public InvalidOperandTypeException​(String reason,
                                           ScalarTokenType required)
        Declares an exception occurred for the specified reason.
        Parameters:
        reason - an explanation of the cause of the error
        required - the type requirement which could not be met
      • InvalidOperandTypeException

        public InvalidOperandTypeException​(String reason,
                                           ScalarValuedFunction operand,
                                           ScalarTokenType operandType)
        Declares an exception occurred for the specified reason, caused by the given subexpression yielding a result of the given type.
        Parameters:
        reason - an explanation of the cause of the error
        operand - the offending subexpression
        operandType - the result type of the offending subexpression
      • InvalidOperandTypeException

        public InvalidOperandTypeException​(String reason,
                                           ScalarTokenType required,
                                           ScalarValuedFunction operand,
                                           ScalarTokenType operandType)
        Declares an exception occurred for the specified reason, caused by the given subexpression yielding a result of the given type.
        Parameters:
        reason - an explanation of the cause of the error
        required - the type requirement which could not be met
        operand - the offending subexpression
        operandType - the result type of the offending subexpression
    • Method Detail

      • addOperand

        public void addOperand​(ScalarValuedFunction operand,
                               ScalarTokenType operandType)
        Adds an additional subexpression and its type to the error.

        In some cases, the type requirement may involve multiple subexpressions; for instance, if all arguments must be comparable. Use this method to this additional information to the exception.

        Parameters:
        operand - the offending subexpression
        operandType - the result type of the offending subexpression
      • getRequiredType

        public ScalarTokenType getRequiredType()
        Gets the type requirement which failed to be satisfied.

        In some cases, this may return TokenTypeConstant.SCALAR, indicating the requirement is more complex than can be expressed by a single type value.

        Returns:
        the type which was required