User Defined Function

The Java™ Integration stage supports the execution of existing user-defined functions that use JavaBeans or primitive types (that are supported by Java Stage) in their calling interface.

To execute the existing user-defined functions, the number of parameters must match the number of input links, and the return value bean must map to an output link. An exception to this rule is that when the Java Integration stage is used as a target, it does not matter whether the user-defined function returns a value or not.

The following example code shows a user-defined function that combines two input records, and writes the result to an output link:

public class UserDefinedFunction

    * Passes primitive type double and a bean as UDF arguments and 
* returns a bean.
    * @param commission commission
    * @param input {@link InputBean} object.
    * @return output {@link UDFOutputBean} object.
   public UDFOutputBean AnnualIncome(double commission, InputBean input)
   {UDFOutputBean output = new UDFOutputBean();


      double total = commission + 
						input.getSalary().doubleValue() + 

      return output;