Interface ExpressionFunctionProvider
- All Superinterfaces:
org.pf4j.ExtensionPoint,com.netflix.spinnaker.kork.plugins.api.internal.SpinnakerExtensionPoint
public interface ExpressionFunctionProvider
extends com.netflix.spinnaker.kork.plugins.api.internal.SpinnakerExtensionPoint
Provides a contract for adding new function definitions for SpEL evaluation.
The SpEL expression evaluator expects the the function implementations are included in the
same concrete class as the ExpressionFunctionProvider, with method names matching those
defined in the getFunctions() definitions.
class HelloFunctionProvider : ExpressionFunctionProvider {
override fun getNamespace(): String? = "netflix"
override fun getFunctions(): Functions =
Functions(
"hello",
FunctionParameter(
Execution::class.java,
"execution",
"The pipeline execution object that this function is being invoked on"
)
)
@JvmStatic
fun hello(execution: Execution): String =
"Hello, ${execution.id}"
}
The above function provider could then be called in a SpEL expression:
${netflix.hello()}
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classA single function definition.static classDocumentation for a function.static classThe definition of a single function parameter.static classA wrapper for a collection ofExpressionFunctionProvider.FunctionDefinitionobjects.static classFunction usage example. -
Method Summary
Modifier and TypeMethodDescriptionA collection ofExpressionFunctionProvider.FunctionDefinitions.Optional.Methods inherited from interface com.netflix.spinnaker.kork.plugins.api.internal.SpinnakerExtensionPoint
getExtensionClass, getPluginId
-
Method Details
-
getNamespace
Optional. Typically, a namespace should be provided if you are providing a non-core function. The namespace value typically would be the name of your organization (e.g.netflixormyteamname. -
getFunctions
ExpressionFunctionProvider.Functions getFunctions()A collection ofExpressionFunctionProvider.FunctionDefinitions.
-