| java.lang.Object org.hecl.java.Reflector
Reflector | public class Reflector (Code) | | The Reflector class maps between Java types and Hecl
types in order to make it possible to call Java methods from Hecl.
author: David N. Welton version: 1.0 |
Constructor Summary | |
public | Reflector(String classname) Creates a new Reflector instance. |
Method Summary | |
public Thing | evaluate(Object o, String cmd, Thing[] argv) The evaluate method takes a target object to
operate on, a methodname, and some Hecl values, and attempts to
find and call a Java method with the supplied values. | public Thing | getConstField(String name) getConstField fetches a constant field value. | public Thing | getField(Object target, String name) The getField method returns the value of an
instance's field. | public Thing | instantiate(Thing[] argv) The instantiate method is called to create an
instance of a class (new, in other words).
Parameters: argv - a Thing value that is mapped onto Javaparameters and passed to the appropriate constructor for theclass. | protected Object[] | mapParams(Class[] outparams, Thing[] argv, int offset) The mapParams method is where the magic happens -
it maps Hecl types/values onto Java types/values.
Parameters: outparams - a Class value Parameters: argv - a Thing value Parameters: offset - an int value - where to startlooking in argv. | public Thing | methods() The methods method returns a Hecl list of method
signatures in the form methodName type type type. |
Reflector | public Reflector(String classname) throws HeclException(Code) | | Creates a new Reflector instance.
Parameters: classname - a String value describing the full name(including package) of a Java class. exception: HeclException - if an error occurs |
evaluate | public Thing evaluate(Object o, String cmd, Thing[] argv) throws HeclException(Code) | | The evaluate method takes a target object to
operate on, a methodname, and some Hecl values, and attempts to
find and call a Java method with the supplied values.
Parameters: o - an Object value Parameters: cmd - a String value Parameters: argv - a Thing value a Thing value exception: HeclException - if an error occurs |
getConstField | public Thing getConstField(String name) throws HeclException(Code) | | getConstField fetches a constant field value.
Parameters: name - a String value a Thing value exception: HeclException - if an error occurs |
getField | public Thing getField(Object target, String name) throws HeclException(Code) | | The getField method returns the value of an
instance's field.
Parameters: target - an Object value Parameters: name - a String value a Thing value exception: HeclException - if an error occurs |
instantiate | public Thing instantiate(Thing[] argv) throws HeclException(Code) | | The instantiate method is called to create an
instance of a class (new, in other words).
Parameters: argv - a Thing value that is mapped onto Javaparameters and passed to the appropriate constructor for theclass. a Thing value exception: HeclException - if an error occurs |
mapParams | protected Object[] mapParams(Class[] outparams, Thing[] argv, int offset) throws HeclException(Code) | | The mapParams method is where the magic happens -
it maps Hecl types/values onto Java types/values.
Parameters: outparams - a Class value Parameters: argv - a Thing value Parameters: offset - an int value - where to startlooking in argv. an Object[] value exception: HeclException - if an error occurs |
methods | public Thing methods() throws HeclException(Code) | | The methods method returns a Hecl list of method
signatures in the form methodName type type type.
a Thing value exception: HeclException - if an error occurs |
|
|