public class ExtensionFunction
extends java.lang.Object
Constructor and Description |
---|
ExtensionFunction(boolean enabled,
java.lang.String script) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getScript() |
static <T> T |
invoke(ExtensibleComponent self,
LoggerEx log,
java.lang.String methodName,
java.lang.Class<T> returnType,
T defaultValue,
java.lang.Object... args)
Helper function to invoke an extension function.
|
static boolean |
isDefined(ExtensibleComponent self,
java.lang.String methodName)
Tests whether or not the given extensible component has an enabled extension function for the given method name
|
boolean |
isEnabled() |
public ExtensionFunction(boolean enabled, java.lang.String script)
public boolean isEnabled()
public java.lang.String getScript()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public static boolean isDefined(ExtensibleComponent self, java.lang.String methodName)
public static <T> T invoke(ExtensibleComponent self, LoggerEx log, java.lang.String methodName, java.lang.Class<T> returnType, T defaultValue, java.lang.Object... args)
self
- The component that is invokinglog
- A logger to log any erros 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.