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()}