Class WurbletArgumentExpression

java.lang.Object
org.tentackle.wurblet.WurbletArgumentExpression
All Implemented Interfaces:
WurbletArgumentOperand

public class WurbletArgumentExpression extends Object implements WurbletArgumentOperand
An expression of wurblet arguments or other expressions.
Author:
harald
  • Constructor Details

    • WurbletArgumentExpression

      public WurbletArgumentExpression(WurbletArgumentExpression parent)
      Creates a new expression.
      Parameters:
      parent - optional parent expression, null if this is the top level expression
  • Method Details

    • getParent

      public WurbletArgumentExpression getParent()
      Gets the parent expression.
      Returns:
      the parent, null if top level
    • getOperands

      public List<WurbletArgumentOperand> getOperands()
      Gets the n operands.
      Returns:
      the operands
    • getOperators

      public List<WurbletArgumentOperator> getOperators()
      Gets the n-1 operators.
      Returns:
      the operators
    • getMergedPaths

      public List<JoinPath> getMergedPaths()
      Gets the paths for wurblet arguments which can be expressed in a single SQL EXISTS clause.
      The returned list is empty, if there are no paths at all or each argument needs its own EXISTS clause.
      Returns:
      the paths, empty if none, never null
    • addOperand

      public WurbletArgumentOperator addOperand(WurbletArgumentOperator operator, WurbletArgumentOperand operand) throws org.wurbelizer.wurbel.WurbelException
      Adds an operand.
      Parameters:
      operator - the operator, null defaults to ADD
      operand - the operand
      Returns:
      the operator, null if start of expression
      Throws:
      org.wurbelizer.wurbel.WurbelException - if failed
    • needParenthesesAfterAndOperator

      public boolean needParenthesesAfterAndOperator()
      Returns whether expression must be enclosed in parentheses after an AND operator.
      Returns:
      true need parentheses
    • toCode

      public String toCode(CodeGenerator<Object> generator) throws org.wurbelizer.wurbel.WurbelException
      Generates the code.
      Parameters:
      generator - the code generator
      Returns:
      the generated code
      Throws:
      org.wurbelizer.wurbel.WurbelException - if code generation failed
    • toString

      public String toString()
      Overrides:
      toString in class Object