Java: from IMendixObject to specific object

1
I have created some java code to build a xpath query using the Core.retrieveXPathQueryEscaped. The xpath returns a list of IMendixObjects. Now I would like to change the reference of an Mendix entity with this list. The problem is that when setting the reference I can not set it to the list of IMendixObjects, I need the specific entity to set the reference. Now I know what kind of entity the IMendixObjects list is. But how do I go from the IMendixObject to the right entity? I tried casting it but I could get this to work. Anybody a clue about how to do this in java? Regards, Ronald
asked
3 answers
2

Use the initialize() method. Create a list of SpecificEntity. For every member of the IMendixObject list use

SpecificEntity specificEntity = SpecificEntity initialize(getContext(), IMendixObjectList.get(i));
answered
1

The method initialize is deprecated. You could use the method load with the same parameters mentioned by Chris nowadays.

answered
0

I think classname.initialize() or classname.load() have the same result, an object with getters and setters?! I didn't know that class.load had been depreciated. Thanks Evandro. I think classname.initialize() is still being used in the autogenerated code of my java actions in version 6.10.10. But I will use classname.load() from now on!

answered