Class PathExp

java.lang.Object
org.apache.cayenne.exp.Expression
org.apache.cayenne.exp.PathExp
All Implemented Interfaces:
XMLSerializable
Direct Known Subclasses:
DbIdPathExp, DbPathExp, ObjPathExp

public abstract sealed class PathExp extends Expression permits DbIdPathExp, DbPathExp, ObjPathExp
Generic path expression.
Since:
5.0
  • Field Details

  • Constructor Details

    • PathExp

      protected PathExp(Object... operands)
      Creates a path node from the single operand: a CayennePath, or any other object whose String form is parsed as a path. A null operand results in an empty path. No operands result in a bare node with no path.
  • Method Details

    • 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
    • setPath

      protected void setPath(CayennePath path)
    • setPath

      protected void setPath(Object path)
    • getPath

      public CayennePath getPath()
    • getExpandedPath

      public CayennePath getExpandedPath()
      Returns the path with aliases expanded, so that each segment is a name of an attribute or a relationship. This is the form that Entity.resolvePath(CayennePath) expects.
    • getPathAliases

      public Map<String,String> getPathAliases()
      Description copied from class: Expression
      Returns a map of path aliases for this expression. It returns a non-empty map only if this is a path expression and the aliases are known at the expression creation time. Otherwise an empty map is returned.
      Overrides:
      getPathAliases in class Expression
    • setPathAliases

      public void setPathAliases(Map<String,String> pathAliases)
    • evaluateEntityNode

      protected Object evaluateEntityNode(Entity<?,?,?> entity)
      Helper method to evaluate path expression with Cayenne Entity.
    • 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
    • exists

      public Expression exists()
      Description copied from class: Expression
      Returns expression that will be dynamically resolved to proper subqueries based on a relationships used (if no relationships are present in the original expression no subqueries will be used).
      Overrides:
      exists in class Expression
      Returns:
      exists expression
      See Also:
    • notExists

      public Expression notExists()
      Description copied from class: Expression
      Returns expression that will be dynamically resolved to proper subqueries based on a relationships used (if no relationships are present in the original expression no subqueries will be used).
      Overrides:
      notExists in class Expression
      Returns:
      not exists expression
      See Also:
    • 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