Fuego.Dynamic : Component

The Component component provides a way to access the methods and attributes of any other component dynamically, without knowing the target component's type at compilation time.

This component uses Java's Reflection mechanism internally.

Example 1

The code in this example instantiates a String object:

component as Component
component = Fuego.Dynamic.Component(className : "java.lang.String")
display component.instance.getClass()

Example 2

The code in this example instantiates a String object that contains the string a string:

component = Fuego.Dynamic.Component(className : "java.lang.String", ["a string"])
display component.instance.toString()

Example 3

The code in this example invokes the length method.

component = Fuego.Dynamic.Component(className : "java.lang.String", ["another string"])
result as Object
result = component.call("length")
display result.toString()