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
Generic path expression.
- Since:
- 5.0
-
Field Summary
FieldsFields inherited from class Expression
operands, PRUNED_NODE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a path node from the single operand: aCayennePath, or any other object whose String form is parsed as a path. -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectevaluateEntityNode(Entity<?, ?, ?> entity) Helper method to evaluate path expression with Cayenne Entity.exists()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).Returns the path withaliasesexpanded, so that each segment is a name of an attribute or a relationship.protected StringgetExpressionOperator(int index) Returns the operator printed between the operands, before the operand at the given index.getOperand(int index) Returns a value of operand atindex: a nested expression or a plain value.intReturns a count of operands of this expression.getPath()Returns a map of path aliases for this expression.inthashCode()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).protected booleanWhether this node is wrapped in parentheses when printed as an operand of another node.voidsetOperand(int index, Object value) Sets a value of operand atindex, growing the operands array if needed.protected voidprotected voidsetPath(CayennePath path) voidsetPathAliases(Map<String, String> pathAliases) Methods inherited from class Expression
andExp, andExp, appendAsString, appendOperandAsString, deepCopy, encodeAsXML, equals, evaluate, evaluateNode, evaluateOperand, expName, filter, filterObjects, first, flattenTree, isValidParent, match, notExp, orExp, orExp, params, params, paramsArray, pruneNodeForPrunedChild, setOperands, shallowCopy, toString, transform, transformExpression, traverse, traverse
-
Field Details
-
path
-
pathAliases
-
-
Constructor Details
-
PathExp
Creates a path node from the single operand: aCayennePath, 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:ExpressionReturns a count of operands of this expression. In real life there are unary (count == 1), binary (count == 2) and ternary (count == 3) expressions.- Overrides:
getOperandCountin classExpression
-
getOperand
Description copied from class:ExpressionReturns a value of operand atindex: a nested expression or a plain value. Operand indexing starts at 0.- Overrides:
getOperandin classExpression
-
setOperand
Description copied from class:ExpressionSets a value of operand atindex, growing the operands array if needed. Operand indexing starts at 0. APersistentis replaced with its ObjectId. A nested expression is asked first whether this node is a valid parent for it, seeExpression.isValidParent(Expression).- Overrides:
setOperandin classExpression
-
setPath
-
setPath
-
getPath
-
getExpandedPath
Returns the path withaliasesexpanded, so that each segment is a name of an attribute or a relationship. This is the form thatEntity.resolvePath(CayennePath)expects. -
getPathAliases
Description copied from class:ExpressionReturns 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:
getPathAliasesin classExpression
-
setPathAliases
-
evaluateEntityNode
-
getExpressionOperator
Description copied from class:ExpressionReturns the operator printed between the operands, before the operand at the given index.- Specified by:
getExpressionOperatorin classExpression
-
exists
Description copied from class:ExpressionReturns 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:
existsin classExpression- Returns:
- exists expression
- See Also:
-
notExists
Description copied from class:ExpressionReturns 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:
notExistsin classExpression- Returns:
- not exists expression
- See Also:
-
hashCode
public int hashCode()- Overrides:
hashCodein classExpression
-
parenthesizeAsOperand
protected boolean parenthesizeAsOperand()Description copied from class:ExpressionWhether 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:
parenthesizeAsOperandin classExpression
-