Documentation of 'org.hecl.java.Reflector' Java class
Reflector
org.hecl.java

Class Reflector



  • public class Reflector
    extends java.lang.Object
    The Reflector class maps between Java types and Hecl types in order to make it possible to call Java methods from Hecl.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Reflector(java.lang.String classname)
      Creates a new Reflector instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      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.
      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

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Reflector

        public Reflector(java.lang.String classname)
                  throws HeclException
        Creates a new Reflector instance.
        Parameters:
        classname - a String value describing the full name (including package) of a Java class.
        Throws:
        HeclException - if an error occurs
    • Method Detail

      • instantiate

        public Thing instantiate(Thing[] argv)
                          throws HeclException
        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 Java parameters and passed to the appropriate constructor for the class.
        Returns:
        a Thing value
        Throws:
        HeclException - if an error occurs
      • getField

        public Thing getField(java.lang.Object target,
                              java.lang.String name)
                       throws HeclException
        The getField method returns the value of an instance's field.
        Parameters:
        target - an Object value
        name - a String value
        Returns:
        a Thing value
        Throws:
        HeclException - if an error occurs
      • setField

        public void setField(java.lang.Object target,
                             java.lang.String name,
                             Thing newvalue)
                      throws HeclException
        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.
        Parameters:
        target - an Object value
        name - a String value
        newvalue - a Thing value
        Throws:
        HeclException - if an error occurs
      • getConstField

        public Thing getConstField(java.lang.String name)
                            throws HeclException
        getConstField fetches a constant field value.
        Parameters:
        name - a String value
        Returns:
        a Thing value
        Throws:
        HeclException - if an error occurs
      • evaluate

        public Thing evaluate(java.lang.Object o,
                              java.lang.String cmd,
                              Thing[] argv)
                       throws HeclException
        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
        cmd - a String value
        argv - a Thing value
        Returns:
        a Thing value
        Throws:
        HeclException - if an error occurs
      • heclTypeToJavaType

        public boolean heclTypeToJavaType(java.lang.Object[] retval,
                                          java.lang.Class rtype,
                                          Thing heclparm)
                                   throws HeclException
        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.
        Parameters:
        retval - an Object value
        rtype - a Class value
        heclparm - a Thing value
        Returns:
        an Object value
        Throws:
        HeclException - if an error occurs
      • javaTypeToHeclType

        public 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.
        Parameters:
        rtype - a Class value
        o - an Object value
        Returns:
        a Thing value
      • methods

        public Thing methods()
                      throws HeclException
        The methods method returns a Hecl list of method signatures in the form methodName type type type.
        Returns:
        a Thing value
        Throws:
        HeclException - if an error occurs
      • constructors

        public Thing constructors()
        The constructors method returns a Hecl list of types that would work as constructors for this object type.
        Returns:
        a Thing value

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.