-
Notifications
You must be signed in to change notification settings - Fork 0
Implementing your own functions
Esta Nagy edited this page Jul 1, 2020
·
3 revisions
Functions are providing endless possibilities. You are at the right place if you want to get the most out of them.
To implement a new function, you need to take only a couple of simple steps. Please find them below:
- Create a class for your function implementing the Function interface
- Create a constructor using only the supported parameter types as parameters
- Annotate your constructor with @NamedFunction
- Annotate all of your constructor parameters as defined here
- Implement the
apply(T)
method coming form the interface. - Register your function using FunctionRegistry#registerFunctionClass(Class)
- Make sure to add your function to the #/definitions/functionTypes/definitions node of our JSON Schema
- Add a new definition similarly to the examples already in there
- Register the type function to the definition of the anyFunction definition by
- Adding the name to the enum containing all the names
- Adding a new object to the list similar to this:
{ "if": { "properties": { "name": { "const": "stringDateAdd" } } }, "then": { "$ref": "#/definitions/functionTypes/definitions/functionStringDateAdd" } }
- Profit!