What´s the best way to use the Java type parameter?

2
I want to create a Java action which has a type parameter as input and a list of that type parameter as output. How can I determine what the object type of my type parameter is and recreate them? My approach at the moment is to clone the input object, but I'm not content with this solution. Any ideas?
asked
2 answers
1

You can use getType on an IMendixObject to find the complete entity name ;-)

answered
2

You create an input parameter, say ResultEntity of type Entity, and you specify that it should be stored in a type parameter.

Next you define a result list of the type stored in the type parameter.

In your java code you will receive a string which contains the entity name. You can use this as follows to create an object:

IMendixObject obj = Core.instantiate(getContext(),this.ResultEntity);

Here's an example java action, both ResultEntity and Return type entity use the same type parameter.

The type parameter:

You can find an example use case on github in the OracleConnector project. The ExecuteQuery action uses a type parameter.

answered