com.go.tea.parsetree
Class Lookup

java.lang.Object
  |
  +--com.go.tea.parsetree.Node
        |
        +--com.go.tea.parsetree.Expression
              |
              +--com.go.tea.parsetree.Lookup
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class Lookup
extends Expression

A Lookup can access properties on objects. A Bean Introspector is used to get the available properties from an object. Arrays, Lists and Strings also have a built-in property named "length". For arrays, the length field is retrieved, for Lists, the size() method is called, and for Strings, the length() method is called.

Version:
24 , 9/07/00
Author:
Brian S O'Neill
See Also:
Introspector, Serialized Form

Inner classes inherited from class com.go.tea.parsetree.Expression
Expression.Conversion
 
Constructor Summary
Lookup(SourceInfo info, Expression expr, Token dot, Name lookupName)
           
 
Method Summary
 java.lang.Object accept(NodeVisitor visitor)
          Every subclass of Node must override this method with the following: return visitor.visit(this).
 java.lang.Object clone()
          Returns a clone of this Node and all its children.
 Token getDot()
           
 Expression getExpression()
           
 Name getLookupName()
           
 java.lang.reflect.Method getReadMethod()
          Returns the method to invoke in order to perform the lookup.
 boolean isExceptionPossible()
          Returns true if an exception can be thrown while executing this Expression.
 void setExpression(Expression expr)
           
 void setReadMethod(java.lang.reflect.Method m)
           
 
Methods inherited from class com.go.tea.parsetree.Expression
convertTo, convertTo, getConversionChain, getInitialType, getType, getValue, isValueKnown, setInitialType, setType
 
Methods inherited from class com.go.tea.parsetree.Node
getSourceInfo, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Lookup

public Lookup(SourceInfo info,
              Expression expr,
              Token dot,
              Name lookupName)
Method Detail

accept

public java.lang.Object accept(NodeVisitor visitor)
Description copied from class: Node
Every subclass of Node must override this method with the following: return visitor.visit(this).
Overrides:
accept in class Expression
Following copied from class: com.go.tea.parsetree.Node
Parameters:
visitor - A visitor of this Node
Returns:
Node The Node returned by the visitor
See Also:
NodeVisitor

clone

public java.lang.Object clone()
Description copied from class: Node
Returns a clone of this Node and all its children. Immutable child objects are not necessarily cloned
Overrides:
clone in class Expression

isExceptionPossible

public boolean isExceptionPossible()
Description copied from class: Expression
Returns true if an exception can be thrown while executing this Expression. By default, returns true only if a type conversion could cause an exception.
Overrides:
isExceptionPossible in class Expression

getExpression

public Expression getExpression()

getDot

public Token getDot()

getLookupName

public Name getLookupName()

getReadMethod

public java.lang.reflect.Method getReadMethod()
Returns the method to invoke in order to perform the lookup. This is filled in by the type checker. If the lookup name is "length" and the expression type is an array, the read method is null. A code generator must still be able to get the length of the array.

setExpression

public void setExpression(Expression expr)

setReadMethod

public void setReadMethod(java.lang.reflect.Method m)