Dynamically create objects

3
Due to some external complex and dynamic webservice I need the following: The webservice publishes all kinds of data. I have stored that in (intermediate) mendix objects with domain-to-xml mappings. So far so good. Now I have to move this intermediate values to the right entity. The attributevalues I can fill with a piece of java,passing an Object, MemberName and MemberValue. CurrentObject.setValue(getContext(), MemberName, MemberValue); That works fine, but I need a JavaAction that return an Object by name: CreateObject("Customer"). This is not possible because the returnvalue must be of a specific entity. Calling Java can be done with 'Any object' I can move the complete microflow to Java, but I am no Java expert, and I prefer microflows. The MxModelreflection has some code like FindObjectType and FindMember but that results in MxModelReflection entities. No clue to get to the 'real data'.
asked
1 answers
3

The only way to return a 'generic' real object into a microflow is to use to use the same generalization entity for all the objects that will be created dynamically. Then your java code can return this type, and in the MF you can upcast to the proper type.

answered