FLX language, it’s virtual machine, FLX Lisp interpreter, and all of its computational features are implemented and based on using Kotlin and JVM. To provide a mechanism to extend FLX capabilities and functionality, FLX provides a simple reflection API consisting of the following functions:
- FLX provides a dedicated Class object that is actually just a Java class.
- Class.forName function returns a Java class for the specified fully qualified class name.
- Class.new function creates an instance of the given Java class. If the constructor of the class takes parameters they can be provided as arguments for this function.
- invoke function calls the function (e.g. setName) specified by its name and with parameters given as function arguments. In the example, function setName has only one parameter of type String.
- getProperty obtains the specified property of the given object. The property is specified by its name.
- setProperty sets the value of the specified property of the given object. The property is specified by its name.
- getClass returns the Java class of the given object.
- isInstance checks if the given object is instance of the class.
Implementation of FLX Reflection API naturally is based on Java’s Reflection API.
FLX’s Search Forms Picker provides means for obtaining Java class forms to be added to code in visual code editor:
- Type the fully qualified class name e.g. java.lang.String.
- If a Java class with the typed name exists it will be provided as a Java Class form.