org.teatrove.tea.parsetree
Class ArrayLookup
java.lang.Object
org.teatrove.tea.parsetree.Node
org.teatrove.tea.parsetree.Expression
org.teatrove.tea.parsetree.ArrayLookup
- All Implemented Interfaces:
- Serializable, Cloneable, NullSafe
public class ArrayLookup
- extends Expression
- implements NullSafe
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.
- Author:
- Brian S O'Neill
- See Also:
BeanAnalyzer,
Serialized Form
ArrayLookup
public ArrayLookup(SourceInfo info,
Expression expr,
Token lookupToken,
Expression lookupIndex)
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()
getLookupToken
public Token getLookupToken()
getLookupIndex
public Expression getLookupIndex()
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 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(Method m)
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.