com.go.tea.parsetree
Class ArrayLookup

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

public class ArrayLookup
extends Expression

An ArrayLookup can access indexed properties on objects. A Bean Introspector can be used to get the available indexed properties from an object, however, the only ones supported by Tea are unnamed. For this reason, the Introspector is not used. Any class with methods named "get" that return something and have a single parameter (the type of which is not limited to ints) will support an array lookup.

Arrays, Collections and Strings are treated specially, and they all support array lookup on an int typed index.

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

Inner classes inherited from class com.go.tea.parsetree.Expression
Expression.Conversion
 
Constructor Summary
ArrayLookup(SourceInfo info, Expression expr, Token lookupToken, Expression lookupIndex)
           
 
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.
 Expression getExpression()
           
 Expression getLookupIndex()
           
 Token getLookupToken()
           
 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 setLookupIndex(Expression lookupIndex)
           
 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

ArrayLookup

public ArrayLookup(SourceInfo info,
                   Expression expr,
                   Token lookupToken,
                   Expression lookupIndex)
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()

getLookupToken

public Token getLookupToken()

getLookupIndex

public Expression getLookupIndex()

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 expression type is an array, the read method is null. A code generator must still be able to get elements from an array.

setExpression

public void setExpression(Expression expr)

setLookupIndex

public void setLookupIndex(Expression lookupIndex)

setReadMethod

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