Overview Module Function Class Tea 3.2.5 Reference Documentation
© 2009 PDM&FC

Module tea.java

Tea reflection over Java objects.

The functions in this module attempt to ease the use of a Java code base without having to write Java wrapper classes (wich can be loaded into the Tea runtime using the load or load-function functions).

The functions provided allow for instatiation with constructor invocation, static method invocation, member field get/set access, and instance method invocation.

Method invocation provides limited support for method overloading. Method invocation search (as described in the Java Language Specification , Third Edition , section 15.12) is simplified by searching all methods with the same name and number of arguments, 1 - in the class of the object being invoked, then 2 - on the interfaces, and 3 - on the superclass. For the set of method that matches the name and number of arguments, the type of the arguments matches if the Java method argument is assignable (using java.lang.Class.isAssignable()) from the Tea value, or by unboxing to a Java primitive type. (No support is provided for narrowing convertions.)

No support is provided for invocation of methods with variable argument lists.

Method arguments, return values, and field get/set values are converted from Tea to Java ana Java to Tea using a few simple rules.

The support for exception handling is limited. All Java Exceptions are converted to Tea runtime errors (as if they were raised using the error function) regardless of their original Java Exception class. The only way to catch them is to use the catch function, which catches all Tea runtime errors (but does not distinguishes between originating Java Exception classes).

Since: 3.2.1

Function Summary
java-exec-method Executes the given static method and returns the result.
java-get-method Returns an anonymous function that can be used to wrap Tea calls to the specified static method.
java-get-value Returns the value stored in the member on the given class or object.
java-new-instance Returns a new instance of the given class using the given arguments.
java-set-value Sets the value of a member on the given class or object.

Overview Module Function Class Tea 3.2.5 Reference Documentation
© 2009 PDM&FC
Report a bug or request new features
© 2009