![]() |
|||||
|
How to invoke an operation?This section shows how to invoke an operation using the JMI reflective interface.
To pass input parameters to the call you create an instance of a parameter structure and assign all the input parameters as attribute values. In case there has not been modeled a parameter structure for the input parameters, such a parameter structure is created implicitely by the generator. The following code snippet shows an example call. Example 6-9. Call an operation // create an instance of the implicitely created parameter structure // PersonSerializeParams and set input parameters RefStruct personSerializeParams = lab1Pkg.refCreateStruct( "org:openmdx:example:lab1:PersonSerializeParams", Arrays.asList(new Object[]{"asString"}) ); // call the operation and receive an instance of the modelled // parameter structure PersonSerializeResult as reply RefStruct result = (RefStruct)person.refInvokeOperation( "org:openmdx:example:lab1:Person:serialize", Arrays.asList(new Object[] { personSerializeParams }) ); String serializedForm = result.refGetValue( "org:openmdx:example:lab1:PersonSerializeResult:result" ); |
||||