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

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.IdentifierExpr
                          extended byorg.apache.jdo.impl.jdoql.tree.StaticFieldAccessExpr
All Implemented Interfaces:
antlr.collections.AST, java.lang.Cloneable, Expression, IdentifierExpression, Node, java.io.Serializable, StaticFieldAccessExpression

public final class StaticFieldAccessExpr
extends IdentifierExpr
implements StaticFieldAccessExpression

This node represents a static field access expression. It inherits from FieldAccessExpr. Static Field access expressions have exactly one child, the target expression. That target expression is an identifier expression.

Author:
Michael Watzek
See Also:
Serialized Form

Field Summary
(package private)  java.lang.reflect.Field field
           
(package private)  java.lang.String fieldName
           
(package private)  JavaField javaField
           
 
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
  StaticFieldAccessExpr()
          The noarg constructor is needed for ANTLR support and deserialization.
  StaticFieldAccessExpr(antlr.Token token)
          The noarg constructor is needed for ANTLR support.
(package private) StaticFieldAccessExpr(TypeImpl type, java.lang.String fieldName)
          This constructor is called by the query tree instance.
 
Method Summary
 void arrive(NodeVisitor visitor)
          Delegates to the argument visitor.
private  java.lang.reflect.Field getField()
           
(package private)  JavaField getFieldInfo()
          Returns the model's field object assciated with this instance.
 java.lang.Object getFieldValue(javax.jdo.PersistenceManager pm)
          Returns the value of the field corresponding with this static field access expression.
 java.lang.String getName()
          Returns the name of the accessed field.
 java.lang.Object leave(NodeVisitor visitor, java.lang.Object[] results)
          Delegates to the argument visitor.
 void setName(java.lang.String fieldName)
          Sets the name of the accessed field.
 
Methods inherited from class org.apache.jdo.impl.jdoql.tree.IdentifierExpr
getTypeName
 
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.IdentifierExpression
getTypeName
 
Methods inherited from interface org.apache.jdo.jdoql.tree.Node
getChildren, getJavaClass, getObject, getParent, getTokenType, setObject, setParent, walkNextChild
 

Field Detail

fieldName

java.lang.String fieldName

javaField

transient JavaField javaField

field

transient java.lang.reflect.Field field
Constructor Detail

StaticFieldAccessExpr

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


StaticFieldAccessExpr

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


StaticFieldAccessExpr

StaticFieldAccessExpr(TypeImpl type,
                      java.lang.String fieldName)
This constructor is called by the query tree instance. It delegates to the super class constructor.

Parameters:
type - the type of the instance wrapping the Java clazz defining the static field
fieldName - the field name of this static field access expression
Throws:
JDOQueryException - if the field cannot be found in the the result type of target.
Method Detail

getName

public java.lang.String getName()
Returns the name of the accessed field. Please note, that this name does not contain any information about the target object of this field access.

Specified by:
getName in interface IdentifierExpression
Overrides:
getName in class IdentifierExpr
Returns:
the field name

setName

public void setName(java.lang.String fieldName)
Sets the name of the accessed field. Please note, that this name must not contain any information about the target object of this field access. This method is used by semantic analysis only.

Parameters:
fieldName - the field name

getFieldValue

public java.lang.Object getFieldValue(javax.jdo.PersistenceManager pm)
Returns the value of the field corresponding with this static field access expression.

Specified by:
getFieldValue in interface StaticFieldAccessExpression
Parameters:
pm - the persistence manager of the query
Returns:
the field value
Throws:
JDOQueryException - if access to the corresponding field of this expression is denied

arrive

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

Specified by:
arrive in interface Node
Overrides:
arrive in class IdentifierExpr
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 IdentifierExpr
Parameters:
visitor - the node visitor
results - the result array
Returns:
the object returned by the visitor instance

getFieldInfo

JavaField getFieldInfo()
Returns the model's field object assciated with this instance. If that field object is null, then it is computed by this method.

Returns:
the model's field object
Throws:
JDOQueryException - if the access to the desired field is denied

getField

private java.lang.reflect.Field getField()