java.lang.Object
com.inductiveautomation.vision.api.client.components.model.ExtensionFunction

public class ExtensionFunction extends Object
  • Constructor Details

    • ExtensionFunction

      public ExtensionFunction(boolean enabled, String script)
  • Method Details

    • isEnabled

      public boolean isEnabled()
    • getScript

      public String getScript()
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • isDefined

      public static boolean isDefined(ExtensibleComponent self, String methodName)
      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 invoking
      log - 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.class
      defaultValue - 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