Class BinaryOperatorExpression

    • Field Detail

      • leftOperandExpression

        protected Expression leftOperandExpression
        Left operand expression for this binary operator expression.
      • rightOperandExpression

        protected Expression rightOperandExpression
        Right operand expression for this binary operator expression.
    • Constructor Detail

      • BinaryOperatorExpression

        public BinaryOperatorExpression()
    • Method Detail

      • initialize

        public void initialize​(ExpressionContext expressionContext,
                               Object parameters,
                               boolean validate)
                        throws ExpressionEngineException
        Initializes the child expressions.
        Specified by:
        initialize in interface Expression
        Parameters:
        expressionContext - contextual information, may help in initialization
        parameters - for example, sub expressions and identifiers
        Throws:
        ExpressionEngineException - if there is any problem during execution
        See Also:
        org.vedantatree.expressionoasis.expressions.Expression#initialize(org.vedantatree.expressionoasis.ExpressionContext, java.lang.Object)
      • getLeftOperandExpression

        public Expression getLeftOperandExpression()
        Gets the value of leftOperandExpression.
        Returns:
        Returns the leftOperandExpression.
      • getRightOperandExpression

        public Expression getRightOperandExpression()
        Gets the value of rightOperandExpression.
        Returns:
        Returns the rightOperandExpression.
      • createTypePair

        protected static final BinaryOperatorExpression.TypePair createTypePair​(Type leftType,
                                                                                Type rightType)
        Creates the type pair for given types pair
        Parameters:
        leftType -
        rightType -
        Returns:
      • addTypePair

        protected static final void addTypePair​(Class clazz,
                                                Type leftType,
                                                Type rightType,
                                                Type resultType)
        Adds the type mapping for the given operator. User can add as many mapping as required for operator. Like in case of '+' operator, one possible mapping is left type = integer, right type = string, result type = string. Because if we add integer to string, it will result in a string value.
        Parameters:
        clazz - class of the operator like +, - etc
        leftType - type of left operand
        rightType - type of right operand
        resultType - type of result
      • getValue

        public ValueObject getValue()
                             throws ExpressionEngineException
        Description copied from interface: Expression
        Executes and returns the value of this expression. If expression is not at node level, it will further evaluate its related expression which may represents operands or operators and return the final outcome.
        Specified by:
        getValue in interface Expression
        Returns:
        the value of expression (after expression evaluation)
        Throws:
        ExpressionEngineException - if there is any problem during execution