Package org.apache.cayenne.exp.parser
Class ASTList
- java.lang.Object
-
- org.apache.cayenne.exp.Expression
-
- org.apache.cayenne.exp.parser.SimpleNode
-
- org.apache.cayenne.exp.parser.ASTList
-
- All Implemented Interfaces:
Serializable
,Node
,XMLSerializable
public class ASTList extends SimpleNode
A leaf expression representing an immutable collection of values.- Since:
- 1.1
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Object[]
values
-
Fields inherited from class org.apache.cayenne.exp.parser.SimpleNode
children, id, parent
-
Fields inherited from class org.apache.cayenne.exp.Expression
ADD, AND, ASTERISK, BETWEEN, BITWISE_AND, BITWISE_LEFT_SHIFT, BITWISE_NOT, BITWISE_OR, BITWISE_RIGHT_SHIFT, BITWISE_XOR, CUSTOM_OP, DB_PATH, DBID_PATH, DIVIDE, ENCLOSING_OBJECT, EQUAL_TO, EXISTS, FALSE, FULL_OBJECT, FUNCTION_CALL, GREATER_THAN, GREATER_THAN_EQUAL_TO, IN, LESS_THAN, LESS_THAN_EQUAL_TO, LIKE, LIKE_IGNORE_CASE, LIST, MULTIPLY, NEGATIVE, NOT, NOT_BETWEEN, NOT_EQUAL_TO, NOT_EXISTS, NOT_IN, NOT_LIKE, NOT_LIKE_IGNORE_CASE, OBJ_PATH, OR, PRUNED_NODE, SUBQUERY, SUBTRACT, TRUE, type
-
-
Constructor Summary
Constructors Constructor Description ASTList()
ASTList(Object[] objects)
Initializes a list expression with an Object[].ASTList(Collection<?> objects)
Initializes a list expression with a Java CollectionASTList(Iterator<?> objects)
Initializes a list expression with a Java Iterator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appendAsEJBQL(List<Object> parameterAccumulator, Appendable out, String rootId)
Stores a String representation of Expression as EJBQL using a provided PrintWriter.void
appendAsString(Appendable out)
Appends own content as a String to the provided Appendable.protected Object
evaluateNode(Object o)
Evaluates itself with object, pushing result on the stack.protected String
getExpressionOperator(int index)
Object
getOperand(int index)
Returns a value of operand atindex
.int
getOperandCount()
Returns a count of operands of this expression.int
getType()
Returns a type of expression.int
hashCode()
void
jjtClose()
Called after all the child nodes have been added.void
setOperand(int index, Object value)
Sets a value of operand atindex
.protected void
setValues(Object value)
Sets an internal collection of values.Expression
shallowCopy()
Creates a copy of this expression node, without copying children.-
Methods inherited from class org.apache.cayenne.exp.parser.SimpleNode
appendAsEJBQL, appendAsEscapedString, appendChildrenAsEJBQL, appendScalarAsString, connectChildren, encodeScalarAsEJBQL, evaluate, evaluateChild, expName, flattenTree, getEJBQLExpressionOperator, getPathAliases, jjtAddChild, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent, notExp, pruneNodeForPrunedChild, unwrapChild, wrapChild
-
Methods inherited from class org.apache.cayenne.exp.Expression
andExp, andExp, deepCopy, encodeAsXML, equals, filter, filterObjects, first, joinExp, joinExp, match, orExp, orExp, params, params, paramsArray, setType, toEJBQL, toEJBQL, toString, transform, transformExpression, traverse, traverse
-
-
-
-
Field Detail
-
values
protected Object[] values
-
-
Constructor Detail
-
ASTList
public ASTList()
-
ASTList
public ASTList(Object[] objects)
Initializes a list expression with an Object[].
-
ASTList
public ASTList(Collection<?> objects)
Initializes a list expression with a Java Collection
-
ASTList
public ASTList(Iterator<?> objects)
Initializes a list expression with a Java Iterator.
-
-
Method Detail
-
shallowCopy
public Expression shallowCopy()
Creates a copy of this expression node, without copying children.- Specified by:
shallowCopy
in classExpression
-
evaluateNode
protected Object evaluateNode(Object o) throws Exception
Description copied from class:SimpleNode
Evaluates itself with object, pushing result on the stack.- Specified by:
evaluateNode
in classSimpleNode
- Throws:
Exception
-
getType
public int getType()
Description copied from class:Expression
Returns a type of expression. Most common types are defined as public static fields of this interface.- Overrides:
getType
in classExpression
-
getExpressionOperator
protected String getExpressionOperator(int index)
- Specified by:
getExpressionOperator
in classSimpleNode
-
appendAsString
public void appendAsString(Appendable out) throws IOException
Description copied from class:Expression
Appends own content as a String to the provided Appendable.- Overrides:
appendAsString
in classSimpleNode
- Throws:
IOException
- Since:
- 4.0
-
appendAsEJBQL
public void appendAsEJBQL(List<Object> parameterAccumulator, Appendable out, String rootId) throws IOException
Description copied from class:Expression
Stores a String representation of Expression as EJBQL using a provided PrintWriter. DB path expressions produce non-standard EJBQL path expressions. If the parameterAccumulator is supplied then as the EJBQL is output, it may load parameters into this list. In this case, the EJBQL output will contain reference to positional parameters. If no parameterAccumulator is supplied and a scalar type is encountered for which there is no EJBQL literal representation (such as dates) then this method will throw a runtime exception to indicate that it was not possible to generate a string-only representation of the Expression in EJBQL.- Overrides:
appendAsEJBQL
in classSimpleNode
- 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 classSimpleNode
-
getOperand
public Object getOperand(int index)
Description copied from class:Expression
Returns a value of operand atindex
. Operand indexing starts at 0.- Overrides:
getOperand
in classSimpleNode
-
setOperand
public void setOperand(int index, Object value)
Description copied from class:Expression
Sets a value of operand atindex
. Operand indexing starts at 0.- Overrides:
setOperand
in classSimpleNode
-
setValues
protected void setValues(Object value)
Sets an internal collection of values. Value argument can be an Object[], a Collection or an iterator.
-
jjtClose
public void jjtClose()
Description copied from interface:Node
Called after all the child nodes have been added.- Specified by:
jjtClose
in interfaceNode
- Overrides:
jjtClose
in classSimpleNode
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classExpression
-
-