Class BinaryExpressionImpl

java.lang.Object
org.apache.olingo.odata2.core.uri.expression.BinaryExpressionImpl
All Implemented Interfaces:
BinaryExpression, CommonExpression, Visitable

public class BinaryExpressionImpl extends Object implements BinaryExpression
  • Field Details

    • operatorInfo

      protected final org.apache.olingo.odata2.core.uri.expression.InfoBinaryOperator operatorInfo
    • leftSide

      protected final CommonExpression leftSide
    • rightSide

      protected final CommonExpression rightSide
    • token

      protected final Token token
    • edmType

      protected EdmType edmType
  • Constructor Details

    • BinaryExpressionImpl

      public BinaryExpressionImpl(org.apache.olingo.odata2.core.uri.expression.InfoBinaryOperator operatorInfo, CommonExpression leftSide, CommonExpression rightSide, Token token)
  • Method Details

    • getOperator

      public BinaryOperator getOperator()
      Specified by:
      getOperator in interface BinaryExpression
      Returns:
      Operator object that represents the used operator
      See Also:
    • getLeftOperand

      public CommonExpression getLeftOperand()
      Specified by:
      getLeftOperand in interface BinaryExpression
      Returns:
      Expression sub tree of the left operand
    • getRightOperand

      public CommonExpression getRightOperand()
      Specified by:
      getRightOperand in interface BinaryExpression
      Returns:
      Expression sub tree of the right operand
    • getEdmType

      public EdmType getEdmType()
      Specified by:
      getEdmType in interface CommonExpression
      Returns:
      The return type of the value represented with this expression. For example the CommonExpression.getEdmType() method for an expression representing the "concat" method will return always "Edm.String".

      This type information is set while parsing the $filter or $orderby expressions and used to do a first validation of the expression. For calculating operators like "add, sub, mul" this type information is purely based on input and output types of the operator as defined in the OData specification. So for $filter=2 add 7 the CommonExpression.getEdmType() method of the binary expression will return Edm.Byte and not Edm.Int16 because the parser performs no real addition.

      However, the application may change this type while evaluating the expression tree.

    • setEdmType

      public CommonExpression setEdmType(EdmType edmType)
      Description copied from interface: CommonExpression
      Set the edmType of this expression node
      Specified by:
      setEdmType in interface CommonExpression
      Parameters:
      edmType - Type to be set
      Returns:
      A self reference for method chaining"
    • getKind

      public ExpressionKind getKind()
      Specified by:
      getKind in interface CommonExpression
      Returns:
      Kind of this expression
      See Also:
    • getUriLiteral

      public String getUriLiteral()
      Description copied from interface: CommonExpression
      Returns the URI literal which lead to the creation of this expression.
      Specified by:
      getUriLiteral in interface CommonExpression
      Returns:
      URI literal
    • accept

      Description copied from interface: Visitable
      Method Visitable.accept(ExpressionVisitor) is called when traversing the expression tree. This method is invoked on each expression used as node in an expression tree. The implementations should behave as follows:
    • Call accept on all sub nodes and store the returned Objects
    • Call the appropriate method on the ExpressionVisitor instance and provide the stored objects to that instance
    • Return the object which should be passed to the processing algorithm of the parent expression node

    • Specified by:
      accept in interface Visitable
      Parameters:
      visitor - Object ( implementing ExpressionVisitor) whose methods are called during traversing a expression node of the expression tree.
      Returns:
      Object which should be passed to the processing algorithm of the parent expression node
      Throws:
      ExceptionVisitExpression - Exception occurred the OData library while traversing the tree
      ODataApplicationException - Exception thrown by the application who implemented the visitor
    • getToken

      public Token getToken()