Capability dynamicInvocation

Another one that would useful for device type developers is the capability to do dynamic invocations of methods using the Object metaclass.

Jim Anderson from ST is aware of this issue.

This would allow developers to be able to reduce their code footprint by calling dynamically different methods at runtime.

The current ST architecture does not allow any meta class use, and I can understand the reasons behind it.

However, being able to do dynamic invocations of methods based on args (Object[]) should be allowed within certain guidelines (to be defined with the engineering team).

Some methods from
http://groovy.codehaus.org/groovy-jdk/java/lang/Object[].html

would then be ‘unblocked’…

Regards.

Keep in mind you can currently achieve some dynamic invocation capabilities, like this:

def myMethod = "handle" + buttonNumber + buttonState.capitalize()
"$myMethod"()

def handle1Pushed() { ...}

I use that in a hue scene app I created for myself to invoke specific button number/state methods.

1 Like

@Jim, I know but as we’ve discussed, you cannot do dynamic invocation with a variable number of arguments.