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

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.ConstantExpr
All Implemented Interfaces:
antlr.collections.AST, java.lang.Cloneable, ConstantExpression, Expression, Node, java.io.Serializable
Direct Known Subclasses:
BooleanLiteralExpr, ByteLiteralExpr, CharLiteralExpr, DoubleLiteralExpr, FloatLiteralExpr, IntLiteralExpr, LongLiteralExpr, ShortLiteralExpr

public class ConstantExpr
extends Expr
implements ConstantExpression

This node represents a constant expression. Examples of constant expressions are BooleanLiteralExpression or ByteLiteralExpression. It does not have any children.

Author:
Michael Watzek
See Also:
Serialized Form

Field Summary
(package private)  java.lang.Object value
           
 
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
  ConstantExpr()
          The noarg constructor is needed for ANTLR support and deserialization.
(package private) ConstantExpr(int tokenType, java.lang.String tokenName, java.lang.Object value)
          This constructor is called by specialized nodes.
(package private) ConstantExpr(java.lang.Object value)
          This constructor is called by the query tree instance.
  ConstantExpr(antlr.Token token)
          The noarg constructor is needed for ANTLR support.
 
Method Summary
 void arrive(NodeVisitor visitor)
          Delegates to the argument visitor.
 java.lang.Object getValue()
          Returns the value represented by this expression.
 java.lang.Object leave(NodeVisitor visitor, java.lang.Object[] results)
          Delegates to the argument visitor.
static ConstantExpr newConstant(java.lang.Object value)
          Returns an instance of ConstantExpression.
 
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
 

Field Detail

value

java.lang.Object value
Constructor Detail

ConstantExpr

public ConstantExpr()
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.


ConstantExpr

public ConstantExpr(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.


ConstantExpr

ConstantExpr(int tokenType,
             java.lang.String tokenName,
             java.lang.Object value)
This constructor is called by specialized nodes. The caller must make sure to set the ANTLR tree structure himself or, call setChildren optionally.

Parameters:
tokenType - the token tpye
tokenName - the name of this node

ConstantExpr

ConstantExpr(java.lang.Object value)
This constructor is called by the query tree instance. It delegates to the super class constructor.

Parameters:
value - the value represented by this expression
Method Detail

newConstant

public static ConstantExpr newConstant(java.lang.Object value)
Returns an instance of ConstantExpression. This method handles null as a constant expression.

Parameters:
value - the object wrapped by the constant expression
Returns:
the constant expression

getValue

public java.lang.Object getValue()
Returns the value represented by this expression.

Specified by:
getValue in interface ConstantExpression
Returns:
the value

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