org.omegahat.Environment.Parser.Parse
Class MethodCall
java.lang.Object
|
+--antlr.BaseAST
|
+--antlr.CommonAST
|
+--org.omegahat.Environment.Parser.Parse.BasicExpression
|
+--org.omegahat.Environment.Parser.Parse.ElementAccess
|
+--org.omegahat.Environment.Parser.Parse.MethodCall
- All Implemented Interfaces:
- antlr.collections.AST, Evaluable, ExpressionInt, OmegaTokenTypes, java.lang.Runnable, java.io.Serializable, Subsettable, TreeNodeInt
- Direct Known Subclasses:
- ConstructorExpression, CorbaMethodCall, MethodTransformationExpression, UserClassMethodCall
- public class MethodCall
- extends ElementAccess
- implements ExpressionInt
Expressions representing a call to a function or a method
of an object or class, containing an expression for the qualifier in which
the method should be invoked (or null implying a function or implicit this),
a list of argument expressions and the name of the function or method.
- See Also:
- Serialized Form
|
Field Summary |
protected List |
args
An ordered collection of the unevaluated arguments to this method
or function call. |
protected boolean |
evalArgs
Indicates whether to the arguments need to be evaluated
or whether they should be left as is. |
protected boolean |
evaluatorMethod
Indicates whether the resolved method
belongs to the evaluator. |
protected boolean |
foundStaticMethod
Indicates that the resolved method is
static method. |
protected java.lang.String |
identifier
String representing the nature of the
the call - function, method, constructor, etc
used in displaying this object. |
protected MethodLocator |
methodLocator
Delegate to resolve methods. |
static java.lang.String |
QuoteMethodName
|
| Fields inherited from class antlr.BaseAST |
down, right |
| Fields inherited from interface org.omegahat.Environment.Parser.AntlrParser.OmegaTokenTypes |
ABSTRACT, ARG_LIST, ARRAY_DECLARATOR, ARRAY_INIT, ASSIGN, BAND, BAND_ASSIGN, BLOCK, BNOT, BOR, BOR_ASSIGN, BREAK, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, CHAR_LITERAL, CLASS_DEF, COLON, COMMA, CONTINUE, CTOR_DEF, DEC, DIV, DIV_ASSIGN, DOT, DOTS, EAGER, ELEMENT_OP, EOF, EQUAL, ESC, EXPONENT, EXPONENT_OP, EXPR, EXTENDS_CLAUSE, FINAL, FLOAT_SUFFIX, FUNCTION, GE, GT, HEX_DIGIT, IDENT, IMPLEMENTS_CLAUSE, IMPORT, INC, INDEX_OP, INSTANCE_INIT, INSTANCEOF, INTERFACE_DEF, LABELED_STAT, LAND, LAZY, LBRACK, LCURLY, LE, LITERAL_abstract, LITERAL_boolean, LITERAL_break, LITERAL_byte, LITERAL_case, LITERAL_catch, LITERAL_char, LITERAL_class, LITERAL_const, LITERAL_continue, LITERAL_default, LITERAL_do, LITERAL_double, LITERAL_eager, LITERAL_else, LITERAL_extends, LITERAL_false, LITERAL_final, LITERAL_finally, LITERAL_float, LITERAL_for, LITERAL_function, LITERAL_global, LITERAL_if, LITERAL_implements, LITERAL_import, LITERAL_in, LITERAL_instanceof, LITERAL_int, LITERAL_interface, LITERAL_lazy, LITERAL_long, LITERAL_method, LITERAL_native, LITERAL_new, LITERAL_null, LITERAL_private, LITERAL_protected, LITERAL_public, LITERAL_return, LITERAL_short, LITERAL_static, LITERAL_super, LITERAL_switch, LITERAL_synchronized, LITERAL_this, LITERAL_threadsafe, LITERAL_throw, LITERAL_throws, LITERAL_transient, LITERAL_true, LITERAL_try, LITERAL_void, LITERAL_while, LNOT, LOR, LPAREN, LT, METHOD, METHOD_CALL, METHOD_DEF, MINUS, MINUS_ASSIGN, MISSING_ARG, ML_COMMENT, MOD, MOD_ASSIGN, MODIFIERS, NOT_EQUAL, NULL_TREE_LOOKAHEAD, NUM_FLOAT, NUM_INT, NUM_LONG, OBJBLOCK, PACKAGE_DEF, PARAMETER_DEF, PARAMETERS, PLUS, PLUS_ASSIGN, POST_DEC, POST_INC, QUESTION, RBRACK, RCURLY, RETURN, RPAREN, SEMI, SEQUENCE_OP, SL, SL_ASSIGN, SL_COMMENT, SLIST, SR, SR_ASSIGN, STAR, STAR_ASSIGN, STATIC_INIT, STRING_LITERAL, SYNCHRONIZED, THROW, TRANSIENT, TYPE, TYPECAST, UNARY_MINUS, UNARY_PLUS, VARIABLE_DEF, VOCAB, WS |
|
Method Summary |
List |
argList(Evaluator evaluator)
|
List |
args()
|
List |
args(List l)
|
List |
args(java.lang.Object[] arguments)
|
java.util.Vector |
argumentClasses(java.lang.Object[] arguments)
|
java.util.Vector |
children()
|
java.lang.String |
elementName(java.lang.String name)
|
java.lang.Object |
eval(Evaluator evaluator)
|
boolean |
evalArgs()
|
boolean |
evalArgs(boolean val)
|
java.lang.Object |
evalFunction(Function func,
Evaluator evaluator)
|
java.lang.Object |
evalFunction(Method func,
Evaluator evaluator)
|
boolean |
evaluatorMethod()
Return whether the method resolved earlier
belongs to the evaluator. |
boolean |
evaluatorMethod(boolean val)
Set whether the method identified by
this object belongs to the evaluator. |
java.lang.Object |
findEvalMethod(Evaluator evaluator,
boolean implicitNew)
|
java.lang.Object |
findEvalMethod(List l,
java.lang.Object source,
Evaluator evaluator,
boolean implicitNew)
|
java.lang.Object |
findEvalMethod(java.lang.Object source,
Evaluator evaluator)
|
java.lang.Object |
findEvalMethod(java.lang.Object source,
Evaluator evaluator,
boolean implicitNew)
|
Name |
fullName()
|
antlr.collections.AST |
getFirstChild()
|
java.lang.Object |
implicitNew(List args,
Evaluator evaluator)
|
java.lang.Object |
implicitNew(java.lang.Object[] args,
Evaluator evaluator)
|
boolean |
isStatic()
Return whether the method resolved earlier
is static. |
boolean |
isStatic(boolean value)
Cache whether the resolved method is
a static method. |
boolean |
isStatic(java.lang.reflect.Method m)
Establishes whether the given method is static
and caches the result in a local variable
for future queries. |
java.lang.Object |
methodInvoke(java.lang.reflect.Method m,
java.lang.Object This,
java.lang.Object[] arguments,
Evaluator evaluator)
|
MethodLocator |
methodLocator()
|
MethodLocator |
methodLocator(MethodLocator l)
|
java.lang.String |
methodName()
Return the name of the method, or in other words, the last element of the
qualified name. |
java.lang.String |
methodName(Name n)
|
java.lang.String |
methodName(java.lang.String n)
|
ExpressionInt |
Quote(Evaluator evaluator)
|
int |
replaceChild(TreeNodeInt originalChild,
TreeNodeInt newChild)
|
java.lang.reflect.Method |
resolveMethod(java.lang.Object[] arguments,
java.lang.Object source,
Evaluator evaluator)
Find the method for the This object relative to these
arguments defining a particular signature call. |
protected boolean |
returnsVoid(java.lang.reflect.Method m)
|
java.lang.reflect.Method |
setAccessible(java.lang.reflect.Method m,
java.lang.Object This)
|
ExpressionInt |
substitute(java.util.Hashtable db,
boolean expand)
|
java.lang.String |
toString()
|
java.lang.Object[] |
transformArguments(java.lang.Class[] classes,
java.lang.Object[] args,
Evaluator evaluator)
Converts the values of the arguments to the specified classes,
changing
single values to arrays of length 1;
objects between the primitive classes, etc. |
java.lang.Object[] |
transformArguments(java.lang.reflect.Method m,
java.lang.Object[] args,
Evaluator evaluator)
Fix up the arguments to match the types expected
by the specified method. |
java.lang.Object |
unqualifiedCall(Evaluator evaluator)
|
| Methods inherited from class org.omegahat.Environment.Parser.Parse.BasicExpression |
addChild, addComment, apply, apply, apply, children, comment, comment, depth, error, eval, evalInit, evaluationFrame, evaluator, getReferencedVariables, getReferencedVariables, getReferencedVariables, isActive, isActive, parent, parent, postComment, postComment, preComment, preComment, render, resolve, run, setParent, setParent, setParent, setParent, showComments, showComments, subset, substitute |
| Methods inherited from class antlr.CommonAST |
getText, getType, initialize, initialize, initialize, setText, setType |
| Methods inherited from class antlr.BaseAST |
addChild, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getNextSibling, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toStringList, toStringTree |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.omegahat.Environment.Language.Evaluable |
eval |
QuoteMethodName
public static java.lang.String QuoteMethodName
args
protected List args
- An ordered collection of the unevaluated arguments to this method
or function call.
evalArgs
protected boolean evalArgs
- Indicates whether to the arguments need to be evaluated
or whether they should be left as is.
identifier
protected java.lang.String identifier
- String representing the nature of the
the call - function, method, constructor, etc
used in displaying this object.
This is set by the derived classes.
Is it ever used?
methodLocator
protected MethodLocator methodLocator
- Delegate to resolve methods.
foundStaticMethod
protected boolean foundStaticMethod
- Indicates that the resolved method is
static method.
evaluatorMethod
protected boolean evaluatorMethod
- Indicates whether the resolved method
belongs to the evaluator.
MethodCall
public MethodCall()
MethodCall
public MethodCall(Name n,
List list)
MethodCall
public MethodCall(ExpressionInt qualifier,
java.lang.String name,
List list)
MethodCall
public MethodCall(ExpressionInt qualifier,
List list)
MethodCall
public MethodCall(java.lang.String name,
List list)
MethodCall
public MethodCall(java.lang.String name,
java.lang.String[] argNames)
eval
public java.lang.Object eval(Evaluator evaluator)
throws java.lang.Throwable
- Specified by:
eval in interface Evaluable- Overrides:
eval in class BasicExpression
methodName
public java.lang.String methodName()
- Return the name of the method, or in other words, the last element of the
qualified name.
methodName
public java.lang.String methodName(Name n)
methodName
public java.lang.String methodName(java.lang.String n)
elementName
public java.lang.String elementName(java.lang.String name)
- Overrides:
elementName in class ElementAccess
argList
public List argList(Evaluator evaluator)
throws java.lang.Throwable
implicitNew
public java.lang.Object implicitNew(List args,
Evaluator evaluator)
throws java.lang.Throwable
implicitNew
public java.lang.Object implicitNew(java.lang.Object[] args,
Evaluator evaluator)
throws java.lang.Throwable
args
public List args(java.lang.Object[] arguments)
evalFunction
public java.lang.Object evalFunction(Function func,
Evaluator evaluator)
throws java.lang.Throwable
evalFunction
public java.lang.Object evalFunction(Method func,
Evaluator evaluator)
throws java.lang.Throwable
methodInvoke
public java.lang.Object methodInvoke(java.lang.reflect.Method m,
java.lang.Object This,
java.lang.Object[] arguments,
Evaluator evaluator)
throws java.lang.Throwable,
java.lang.reflect.InvocationTargetException,
java.lang.IllegalArgumentException,
java.lang.IllegalAccessException
setAccessible
public java.lang.reflect.Method setAccessible(java.lang.reflect.Method m,
java.lang.Object This)
throws java.lang.IllegalAccessException
resolveMethod
public java.lang.reflect.Method resolveMethod(java.lang.Object[] arguments,
java.lang.Object source,
Evaluator evaluator)
throws java.lang.Throwable
- Find the method for the This object relative to these
arguments defining a particular signature call.
returnsVoid
protected boolean returnsVoid(java.lang.reflect.Method m)
isStatic
public boolean isStatic(boolean value)
- Cache whether the resolved method is
a static method.
isStatic
public boolean isStatic(java.lang.reflect.Method m)
- Establishes whether the given method is static
and caches the result in a local variable
for future queries.
isStatic
public boolean isStatic()
- Return whether the method resolved earlier
is static.
evaluatorMethod
public boolean evaluatorMethod()
- Return whether the method resolved earlier
belongs to the evaluator.
evaluatorMethod
public boolean evaluatorMethod(boolean val)
- Set whether the method identified by
this object belongs to the evaluator.
This means either it the qualifier is
-
null and there is no function or method
of the same name
- is
this
- explicitly,
evaluator()
argumentClasses
public java.util.Vector argumentClasses(java.lang.Object[] arguments)
evalArgs
public boolean evalArgs()
evalArgs
public boolean evalArgs(boolean val)
args
public List args()
args
public List args(List l)
findEvalMethod
public java.lang.Object findEvalMethod(java.lang.Object source,
Evaluator evaluator)
throws java.lang.Throwable
findEvalMethod
public java.lang.Object findEvalMethod(java.lang.Object source,
Evaluator evaluator,
boolean implicitNew)
throws java.lang.Throwable
findEvalMethod
public java.lang.Object findEvalMethod(List l,
java.lang.Object source,
Evaluator evaluator,
boolean implicitNew)
throws java.lang.Throwable
findEvalMethod
public java.lang.Object findEvalMethod(Evaluator evaluator,
boolean implicitNew)
throws java.lang.Throwable
fullName
public Name fullName()
toString
public java.lang.String toString()
- Overrides:
toString in class BasicExpression
Quote
public ExpressionInt Quote(Evaluator evaluator)
unqualifiedCall
public java.lang.Object unqualifiedCall(Evaluator evaluator)
throws java.lang.Throwable
transformArguments
public java.lang.Object[] transformArguments(java.lang.reflect.Method m,
java.lang.Object[] args,
Evaluator evaluator)
- Fix up the arguments to match the types expected
by the specified method. This fixes scalars to arrays,
conversion between certain primitives (e.g. double to int)
transformArguments
public java.lang.Object[] transformArguments(java.lang.Class[] classes,
java.lang.Object[] args,
Evaluator evaluator)
- Converts the values of the arguments to the specified classes,
changing
- single values to arrays of length 1;
- objects between the primitive classes, etc. to their primitive values,
This is called after we know we have a match between the arguments
and a Method.
methodLocator
public MethodLocator methodLocator()
methodLocator
public MethodLocator methodLocator(MethodLocator l)
children
public java.util.Vector children()
- Specified by:
children in interface TreeNodeInt- Overrides:
children in class BasicExpression
replaceChild
public int replaceChild(TreeNodeInt originalChild,
TreeNodeInt newChild)
- Specified by:
replaceChild in interface TreeNodeInt- Overrides:
replaceChild in class BasicExpression
substitute
public ExpressionInt substitute(java.util.Hashtable db,
boolean expand)
- Overrides:
substitute in class BasicExpression
getFirstChild
public antlr.collections.AST getFirstChild()
- Overrides:
getFirstChild in class ElementAccess