Getting the most out of the Java Class step
In the previous sections, you learned how to use the Java Class
step to accomplish basic tasks. The step has a few more characteristics that allow you to create a rich code. The following subsections summarize some of them.
Receiving parameters
To write a more flexible code, you can add parameters. You can do it by configuring the Parameters
tab in the lower grid of the Java Class configuration window. For each new parameter, you have to provide a name under the Tag
column and a value under the Value
column as follows:
Adding parameters
Note
Note that the value for a Java Class
parameter can be a fixed value as well as a PDI variable.
In your code, you read a parameter using the getParameter()
function, as follows:
String code = getParameter("CODE");
Note that the parameters don't have a data type and they are read as string values. In case you need to use them in a different format, you should cast the values to the proper data type, as shown in the...