Type parameters in Java actions

0
When making a java action, using a type parameter makes the java better suited to being exported for use in other projects. Type parameters come in as: private IMendixObject source; Whereas an object parameter objects come in as: private IMendixObject __source; private modulename.proxies.entityname source; So, if you were to use a type parameter, how would you then reference the entity that it has come from? source.getType() would return modulename.entityname, but how would you then use this to reference the object that has been selected when you can use "import modulename.proxies.entityname"?
asked
1 answers
1

Hi Harry,

I might be wrong, but I believe the purpose of the type parameter is not to make java code better but to make the modeler better. With a type parameter it is impossible that by accident (or copy-pasting) you pass an object of the incorrect type to the java action.

IOP proxies are only meant to be used with objects that have a fixed type i.e. no type parameter. If you have a type parameter you should stick to using the mendix objects such as IMendixObject-which represents an object and IMetaObject - which represents an entity. You can find a lot of info here https://apidocs.mendix.com/7/runtime/

For me, the most usefull functions are

mendix_object.getMember/s

mendix_object.get/setValue

Hope this helps,

Andrej

answered