In LSPS, a function is declared in a function definition file. The file can be then distributed in a library module to allow other users to make use of the function.
Once declared a function can be implemented in Java or in the Expression Language. For Java implementation, you will need to create and deploy a class with the method that the function will call, while if using the Expression Language the expression is defined directly in the function definition.
To create a custom function with implementation in Java or the Expression Language, do the following:
Add a new function and define the function main details:
Generic types: comma-separated list of abstractions of data types used in parameters
Generic types allow functions to operate over a parameter that can be of various data types (not only a single data type) in different calls. The concept is based on generics as used in Java. You can also make a generic data type extend another data type with the extends
keyword. The syntax is then <generic_type_1> extends <type1>, <generic_type_2> extends <type2>
(for details, refer to the Expression Language User Guide).
Variadic: function arity
A function is variadic if its last parameter can be declared variadic, that is, zero or more occurrences of that last parameter are allowed.
Has side effects: if true, on validation, the info notification about the function having a side effect is suppressed
A function is considered to have side effects if one of the following is true:
Note: Functions can be overloaded: functions with the same name but different parameters are considered different functions.
You can now use the function call in your Module. Consider distributing the Module with the function declaration as a library.