Class ListExp

java.lang.Object
org.apache.cayenne.exp.Expression
org.apache.cayenne.exp.ListExp
All Implemented Interfaces:
XMLSerializable

public final class ListExp extends Expression
A leaf expression representing an immutable collection of values.
Since:
5.0
  • Field Details

    • values

      protected Object[] values
  • Constructor Details

    • ListExp

      public ListExp(Object... elements)
      Creates a list of the given elements. A single Collection, array or Iterator argument is taken as the elements themselves.
  • Method Details

    • shallowCopy

      public Expression shallowCopy()
      Creates a copy of this expression node, without copying children.
      Specified by:
      shallowCopy in class Expression
    • evaluateNode

      protected Object evaluateNode(Object o) throws Exception
      Description copied from class: Expression
      Evaluates itself with object, pushing result on the stack.
      Specified by:
      evaluateNode in class Expression
      Throws:
      Exception
    • getExpressionOperator

      protected String getExpressionOperator(int index)
      Description copied from class: Expression
      Returns the operator printed between the operands, before the operand at the given index.
      Specified by:
      getExpressionOperator in class Expression
    • appendAsString

      public void appendAsString(Appendable out) throws IOException
      Description copied from class: Expression
      Appends own content as a String to the provided Appendable: the operands separated by the operator.
      Overrides:
      appendAsString in class Expression
      Throws:
      IOException
    • getOperandCount

      public int getOperandCount()
      Description copied from class: Expression
      Returns a count of operands of this expression. In real life there are unary (count == 1), binary (count == 2) and ternary (count == 3) expressions.
      Overrides:
      getOperandCount in class Expression
    • getOperand

      public Object getOperand(int index)
      Description copied from class: Expression
      Returns a value of operand at index: a nested expression or a plain value. Operand indexing starts at 0.
      Overrides:
      getOperand in class Expression
    • setOperand

      public void setOperand(int index, Object value)
      Description copied from class: Expression
      Sets a value of operand at index, growing the operands array if needed. Operand indexing starts at 0. A Persistent is replaced with its ObjectId. A nested expression is asked first whether this node is a valid parent for it, see Expression.isValidParent(Expression).
      Overrides:
      setOperand in class Expression
    • setValues

      protected void setValues(Object value)
      Sets an internal collection of values. Value argument can be an Object[], a Collection or an iterator.
    • setOperands

      public void setOperands(Object... elements)
      Sets the elements of this list. This is how the parser passes the parsed elements.
      Overrides:
      setOperands in class Expression
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Expression
    • parenthesizeAsOperand

      protected boolean parenthesizeAsOperand()
      Description copied from class: Expression
      Whether this node is wrapped in parentheses when printed as an operand of another node. Compound nodes are, leaves and nodes with their own delimiters (function calls, lists) are not.
      Overrides:
      parenthesizeAsOperand in class Expression