Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

openjava.ptree
Class FieldAccess  view FieldAccess download FieldAccess.java

java.lang.Object
  extended byopenjava.ptree.ParseTreeObject
      extended byopenjava.ptree.NonLeaf
          extended byopenjava.ptree.FieldAccess
All Implemented Interfaces:
java.lang.Cloneable, Expression, ParseTree, VariableInitializer

public class FieldAccess
extends NonLeaf
implements Expression

The FieldAccess class represents a field access like :

     f().str
 

In this field access, you can get f() by getReferenceExpr() and can get str by getName() .
Warning this class may has bugs around the expression.


Field Summary
 
Fields inherited from class openjava.ptree.NonLeaf
 
Fields inherited from class openjava.ptree.ParseTreeObject
LN
 
Constructor Summary
(package private) FieldAccess()
           
  FieldAccess(Expression expr, java.lang.String name)
          An access to the specified field of the given expression.
  FieldAccess(openjava.mop.OJClass clazz, java.lang.String name)
          An access to the specified static field of the type.
  FieldAccess(java.lang.String name)
          An access to the specified field of self.
  FieldAccess(TypeName typename, java.lang.String name)
          An access to the specified static field of the type.
 
Method Summary
 void accept(openjava.ptree.util.ParseTreeVisitor v)
          Accepts a ParseTreeVisitor object as the role of a Visitor in the Visitor pattern, as the role of an Element in the Visitor pattern.
 java.lang.String getName()
          Gets the field name.
 ParseTree getReference()
           
 Expression getReferenceExpr()
          Gets the expression accessed.
 TypeName getReferenceType()
           
 openjava.mop.OJClass getType(openjava.mop.Environment env)
           
 boolean isTypeReference()
           
private static openjava.mop.OJField pickupField(openjava.mop.OJClass reftype, java.lang.String name)
           
 void setName(java.lang.String name)
          Sets the field name.
 void setReferenceExpr(Expression expr)
          Sets the expression accessed.
 void setReferenceType(TypeName typename)
           
 
Methods inherited from class openjava.ptree.NonLeaf
childrenAccept, elementAt, equals, getComment, getContents, getLength, makeRecursiveCopy, replaceChildWith, set, set, set, set, set, set, set, set, set, setComment, setElementAt
 
Methods inherited from class openjava.ptree.ParseTreeObject
clone, equal, getObjectID, getParent, hashCode, lastObjectID, makeCopy, replace, setParent, toFlattenString, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface openjava.ptree.ParseTree
childrenAccept, equals, getObjectID, makeCopy, makeRecursiveCopy, replace, toFlattenString, toString
 

Constructor Detail

FieldAccess

public FieldAccess(Expression expr,
                   java.lang.String name)
An access to the specified field of the given expression.


FieldAccess

public FieldAccess(TypeName typename,
                   java.lang.String name)
An access to the specified static field of the type.


FieldAccess

public FieldAccess(openjava.mop.OJClass clazz,
                   java.lang.String name)
An access to the specified static field of the type.


FieldAccess

public FieldAccess(java.lang.String name)
An access to the specified field of self.


FieldAccess

FieldAccess()
Method Detail

getReference

public ParseTree getReference()

isTypeReference

public boolean isTypeReference()

getReferenceExpr

public Expression getReferenceExpr()
Gets the expression accessed.


setReferenceExpr

public void setReferenceExpr(Expression expr)
Sets the expression accessed.


getReferenceType

public TypeName getReferenceType()

setReferenceType

public void setReferenceType(TypeName typename)

getName

public java.lang.String getName()
Gets the field name.


setName

public void setName(java.lang.String name)
Sets the field name.


accept

public void accept(openjava.ptree.util.ParseTreeVisitor v)
            throws ParseTreeException
Description copied from interface: ParseTree
Accepts a ParseTreeVisitor object as the role of a Visitor in the Visitor pattern, as the role of an Element in the Visitor pattern.

This invoke an appropriate visit() method on the accepted visitor.

Specified by:
accept in interface ParseTree
Specified by:
accept in class ParseTreeObject

getType

public openjava.mop.OJClass getType(openjava.mop.Environment env)
                             throws java.lang.Exception
Specified by:
getType in interface Expression

pickupField

private static openjava.mop.OJField pickupField(openjava.mop.OJClass reftype,
                                                java.lang.String name)