org.apache.jdo.impl.jdoql.tree
Class CastExpr

java.lang.Object
  extended byantlr.BaseAST
      extended byantlr.CommonAST
          extended byorg.apache.jdo.impl.jdoql.jdoqlc.JDOQLAST
              extended byorg.apache.jdo.impl.jdoql.tree.NodeImpl
                  extended byorg.apache.jdo.impl.jdoql.tree.Expr
                      extended byorg.apache.jdo.impl.jdoql.tree.CastExpr
All Implemented Interfaces:
antlr.collections.AST, CastExpression, java.lang.Cloneable, Expression, Node, java.io.Serializable

public final class CastExpr
extends Expr
implements CastExpression

This node represents a cast expression. It has a result type and a child which corresponds with the expression to cast.

Author:
Michael Watzek
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.jdo.impl.jdoql.tree.NodeImpl
children, clazz, msg, object, parent
 
Fields inherited from class org.apache.jdo.impl.jdoql.jdoqlc.JDOQLAST
column, line, typeInfo
 
Fields inherited from class antlr.CommonAST
 
Fields inherited from class antlr.BaseAST
down, right
 
Constructor Summary
  CastExpr()
          The noarg constructor is needed for ANTLR support and deserialization.
  CastExpr(antlr.Token token)
          The noarg constructor is needed for ANTLR support.
(package private) CastExpr(Type type, Expression expr)
          This constructor is called by the query tree instance.
 
Method Summary
 void arrive(NodeVisitor visitor)
          Delegates to the argument visitor.
 Expression getExpression()
          Returns the node's cast expression.
 java.lang.String getTypeName()
          Returns the string representation of the Java class, to which this node's expression is casted.
 java.lang.Object leave(NodeVisitor visitor, java.lang.Object[] results)
          Delegates to the argument visitor.
 
Methods inherited from class org.apache.jdo.impl.jdoql.tree.NodeImpl
ASTToChildren, clone, getChildren, getJavaClass, getObject, getParent, getTokenType, setChildren, setObject, setParent, toString, walkNextChild
 
Methods inherited from class org.apache.jdo.impl.jdoql.jdoqlc.JDOQLAST
getColumn, getLine, getTypeInfo, initialize, initialize, initialize, setColumn, setLine, setTypeInfo, treeToString
 
Methods inherited from class antlr.CommonAST
getText, getType, initialize, setText, setType
 
Methods inherited from class antlr.BaseAST
addChild, decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getFirstChild, getNextSibling, getNumberOfChildren, getTokenNames, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.jdo.jdoql.tree.Node
getChildren, getJavaClass, getObject, getParent, getTokenType, setObject, setParent, walkNextChild
 

Constructor Detail

CastExpr

public CastExpr()
The noarg constructor is needed for ANTLR support and deserialization. The caller must make sure to set the ANTLR tree structure himself or, call setChildren optionally.


CastExpr

public CastExpr(antlr.Token token)
The noarg constructor is needed for ANTLR support. The caller must make sure to set the ANTLR tree structure himself or, call setChildren optionally.


CastExpr

CastExpr(Type type,
         Expression expr)
This constructor is called by the query tree instance. It delegates to the super class constructor.

Parameters:
type - the type instance wrapping the Java class to which the argument expr is casted
expr - the expression to cast
Throws:
JDOQueryException - if the result type of expr cannot be casted to clazz
Method Detail

getTypeName

public java.lang.String getTypeName()
Returns the string representation of the Java class, to which this node's expression is casted.

Specified by:
getTypeName in interface CastExpression
Returns:
the Java type name

getExpression

public Expression getExpression()
Returns the node's cast expression.

Specified by:
getExpression in interface CastExpression
Returns:
the node's cast expression

arrive

public void arrive(NodeVisitor visitor)
Delegates to the argument visitor.

Specified by:
arrive in interface Node
Overrides:
arrive in class NodeImpl
Parameters:
visitor - the node visitor

leave

public java.lang.Object leave(NodeVisitor visitor,
                              java.lang.Object[] results)
Delegates to the argument visitor.

Specified by:
leave in interface Node
Overrides:
leave in class NodeImpl
Parameters:
visitor - the node visitor
results - the result array
Returns:
the object returned by the visitor instance