|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hecl.java.Reflector
public class Reflector
The Reflector
class maps between Java types and Hecl
types in order to make it possible to call Java methods from Hecl.
Constructor Summary | |
---|---|
Reflector(java.lang.String classname)
Creates a new Reflector instance. |
Method Summary | |
---|---|
Thing |
constructors()
The constructors method returns a Hecl list of
types that would work as constructors for this object type. |
Thing |
evaluate(java.lang.Object o,
java.lang.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. |
Thing |
getConstField(java.lang.String name)
getConstField fetches a constant field value. |
Thing |
getField(java.lang.Object target,
java.lang.String name)
The getField method returns the value of an
instance's field. |
boolean |
heclTypeToJavaType(java.lang.Object[] retval,
java.lang.Class rtype,
Thing heclparm)
The heclTypeToJavaType method takes a Class and a
Hecl Thing, turns the Thing into an Object based on the Class
type, and returns the Object. |
Thing |
instantiate(Thing[] argv)
The instantiate method is called to create an
instance of a class (new, in other words). |
Thing |
javaTypeToHeclType(java.lang.Class rtype,
java.lang.Object o)
The javaTypeToHeclType method takes a Java type,
and a Java Object, and returns a Thing. |
protected boolean |
mapParams(java.lang.Object[] retval,
java.lang.Class[] outparams,
Thing[] argv,
int offset)
The mapParams method is where a series of Hecl
types/values are mapped onto Java types/values. |
Thing |
methods()
The methods method returns a Hecl list of method
signatures in the form methodName type type type. |
void |
setField(java.lang.Object target,
java.lang.String name,
Thing newvalue)
The setField method takes an object, a field name,
and a new Thing value, and sets the object's field to the value
of Thing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Reflector(java.lang.String classname) throws HeclException
Reflector
instance.
classname
- a String
value describing the full name
(including package) of a Java class.
HeclException
- if an error occursMethod Detail |
---|
public Thing instantiate(Thing[] argv) throws HeclException
instantiate
method is called to create an
instance of a class (new, in other words).
argv
- a Thing
value that is mapped onto Java
parameters and passed to the appropriate constructor for the
class.
Thing
value
HeclException
- if an error occurspublic Thing getField(java.lang.Object target, java.lang.String name) throws HeclException
getField
method returns the value of an
instance's field.
target
- an Object
valuename
- a String
value
Thing
value
HeclException
- if an error occurspublic void setField(java.lang.Object target, java.lang.String name, Thing newvalue) throws HeclException
setField
method takes an object, a field name,
and a new Thing value, and sets the object's field to the value
of Thing.
target
- an Object
valuename
- a String
valuenewvalue
- a Thing
value
HeclException
- if an error occurspublic Thing getConstField(java.lang.String name) throws HeclException
getConstField
fetches a constant field value.
name
- a String
value
Thing
value
HeclException
- if an error occurspublic Thing evaluate(java.lang.Object o, java.lang.String cmd, Thing[] argv) throws HeclException
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.
o
- an Object
valuecmd
- a String
valueargv
- a Thing
value
Thing
value
HeclException
- if an error occursprotected boolean mapParams(java.lang.Object[] retval, java.lang.Class[] outparams, Thing[] argv, int offset) throws HeclException
mapParams
method is where a series of Hecl
types/values are mapped onto Java types/values.
retval
- an Object
valueoutparams
- a Class
valueargv
- a Thing
valueoffset
- an int
value - where to start
looking in argv.
Object[]
value
HeclException
- if an error occurspublic boolean heclTypeToJavaType(java.lang.Object[] retval, java.lang.Class rtype, Thing heclparm) throws HeclException
heclTypeToJavaType
method takes a Class and a
Hecl Thing, turns the Thing into an Object based on the Class
type, and returns the Object.
retval
- an Object
valuertype
- a Class
valueheclparm
- a Thing
value
Object
value
HeclException
- if an error occurspublic Thing javaTypeToHeclType(java.lang.Class rtype, java.lang.Object o)
javaTypeToHeclType
method takes a Java type,
and a Java Object, and returns a Thing.
rtype
- a Class
valueo
- an Object
value
Thing
valuepublic Thing methods() throws HeclException
methods
method returns a Hecl list of method
signatures in the form methodName type type type.
Thing
value
HeclException
- if an error occurspublic Thing constructors()
constructors
method returns a Hecl list of
types that would work as constructors for this object type.
Thing
value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |