Class ExtensionFunction
java.lang.Object
com.inductiveautomation.vision.api.client.components.model.ExtensionFunction
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
static <T> T
invoke
(ExtensibleComponent self, LoggerEx log, String methodName, Class<T> returnType, T defaultValue, Object... args) Helper function to invoke an extension function.static boolean
isDefined
(ExtensibleComponent self, String methodName) Tests whether the given extensible component has an enabled extension function for the given method nameboolean
-
Constructor Details
-
ExtensionFunction
-
-
Method Details
-
isEnabled
public boolean isEnabled() -
getScript
-
equals
-
isDefined
Tests whether the given extensible component has an enabled extension function for the given method name -
invoke
public static <T> T invoke(ExtensibleComponent self, LoggerEx log, String methodName, Class<T> returnType, T defaultValue, Object... args) Helper function to invoke an extension function.- Parameters:
self
- The component that is invokinglog
- A logger to log any errors to. This function never throws an exception. Any problems are logged to this logger and the default will be returned.methodName
- The name of the extension function. Must match the associated ExtensionFunctionDescriptor's method name.returnType
- The type to coerce the script's return value into. For functions that don't need to return anything, use Void.classdefaultValue
- The default return value. This will be returned if this extension function isn't implemented on self.args
- Arguments to pass to the function.- Returns:
- whatever value the extensible function returned, or defaultValue if there was no extension function defined
-