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.
Reflection API Functions

Returns a Java Class
for the given fully qualified class name.
className
– the fully qualified class name (e.g.java.lang.Int
) as aString
Returns: a Java Class
.

Creates a new instance of the specified Java class. The Class
constructor may require parameters.
class
– a JavaClass
params
– optional parameters.
Returns: The created instance

Returns the Java Class
of the given object
.
object
– anAny
object
Returns: A Java Class

Returns the value of the specified property
of the given object
.
object
– anAny
objectproperty
– the name of the property as a `String“
Returns: the value of the property

Invokes the specified method
for the given object
. The invoked method may have parameters that should be given as additional parameters.
object
– anAny
objectmethod
– the name of the method
Returns: the value from method invocation

Tests if the given object
is an instance of the specified class
. This function is same as (isInstance
object
class
)
, but provides more Kotlin-ish syntax.
object
– anAny
objectclass
– a JavaClass
Returns: a Boolean
value.

Tests if the given object
is an instance of the specified class
. This function is same as (is
object
class
)
, but provides more Lisp-ish syntax.
object
– anAny
objectclass
– a JavaClass
Returns: a Boolean
value.

Sets the given value
to be current value of the specified property
of the given object
.
object
– anAny
objectproperty
– the name of the property as aString
value
– the value to be set
Returns: the set value
Examples
Here are examples of using the Reflection API functions described above.

- 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.