org.teatrove.tea.parsetree
Class Lookup

java.lang.Object
  extended by org.teatrove.tea.parsetree.Node
      extended by org.teatrove.tea.parsetree.Expression
          extended by org.teatrove.tea.parsetree.Lookup
All Implemented Interfaces:
Serializable, Cloneable, NullSafe

public class Lookup
extends Expression
implements NullSafe

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.

Author:
Brian S O'Neill
See Also:
Introspector, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.teatrove.tea.parsetree.Expression
Expression.Conversion
 
Constructor Summary
Lookup(SourceInfo info, Expression expr, Token dot, Name lookupName)
           
 
Method Summary
 Object accept(NodeVisitor visitor)
          Every subclass of Node must override this method with the following: return visitor.visit(this).
 Object clone()
          Returns a clone of this Node and all its children.
 Token getDot()
           
 Expression getExpression()
           
 Name getLookupName()
           
 Method getReadMethod()
          Returns the method to invoke in order to perform the lookup.
 Field getReadProperty()
          Returns the field to use in order to perform the lookup.
 boolean isExceptionPossible()
          Returns true if an exception can be thrown while executing this Expression.
 boolean isNullSafe()
           
 void setExpression(Expression expr)
           
 void setNullSafe(boolean nullSafe)
           
 void setReadMethod(Method m)
           
 void setReadProperty(Field f)
           
 
Methods inherited from class org.teatrove.tea.parsetree.Expression
convertTo, convertTo, forceConversion, getConversionChain, getInitialType, getType, getValue, isValueKnown, setInitialType, setType
 
Methods inherited from class org.teatrove.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 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
Parameters:
visitor - A visitor of this Node
Returns:
Node The Node returned by the visitor
See Also:
NodeVisitor

clone

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

setExpression

public void setExpression(Expression expr)

getReadMethod

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


setReadMethod

public void setReadMethod(Method m)

getReadProperty

public Field getReadProperty()
Returns the field to use in order to perform the lookup. This is filled in by the type checker when a static constant is being referenced rather than a variable lookup.


setReadProperty

public void setReadProperty(Field f)

isNullSafe

public boolean isNullSafe()
Specified by:
isNullSafe in interface NullSafe

setNullSafe

public void setNullSafe(boolean nullSafe)
Specified by:
setNullSafe in interface NullSafe


Copyright © 1997-2012 TeaTrove.org. All Rights Reserved.