executeTransientMethod
executeTransientMethod(meth: JadeMethod; receiver: Any; params: ParamListType): Any;
The executeTransientMethod method of the Process class executes the transient JADE method specified in the meth parameter. This method returns the result value returned by the executed method. The method is executed as part of the current JADE process and any references to system variables (for example,
The method that is executed must have been created by using the Process class createTransientMethod method.
The executeTransientMethod method parameters are listed in the following table.
Parameter | Description |
---|---|
meth | The transient method to be executed. |
receiver | The receiving object. |
params | Maps to a variable list of zero or more parameters of any type that are to be passed to the method that is executed. (The ParamListType pseudo type can be used only as a formal parameter in a method signature. You cannot define a local variable with a type of ParamListType.) |
The following example shows the use of the createTransientMethod, executeTransientMethod, and deleteTransientMethod methods to select objects according to dynamic selection criteria. For example, an input of 'name[1] = "M"' would display customers whose names start with the letter M. The selection expression needs to be compiled only once, and is more efficient than using the executeScript method where the compilation overhead would occur for each customer.
vars input, str : String; meth : JadeMethod; err, pos, len : Integer; cust : Customer; begin read input; str := "return " & input & ";"; meth := process.createTransientMethod("select", Customer, currentSchema, str, true, Boolean, err, pos, len); if meth <> null then foreach cust in Company.firstInstance.allCustomers where process.executeTransientMethod(meth, cust).Boolean do write cust.name; endforeach; else write "Compiler error " & err.String & " - " & process.getErrorText(err); endif; epilog if meth <> null then process.deleteTransientMethod(meth); endif; end;
For details about the ParamListType pseudo type specified in the last formal parameter (params), see "