Retrieve all metaobjects in Java that are created in the modeler.

I would like to know how to retrieve all the metaobjects that are in my project. When I have all those objects I want to loop over those objects. Then I want to check if the metaobject is a superclass of the inputobject. If the metaobject is a superclass of the inputobject, I would like to retrieve the members of the metaobject. This should all be done in a Java action. How can I do this?
2 answers

Hi Marco,

To get all metaobjects you can use Core.getMetaObjects() .

Super/subclass relations can be checked by using Core.isSubClassOf(IMetaObject superObject, IMetaObject type).

By using getMetaPrimitives(), getMetaAssociationsParent() and getMetaAssociationsChild() on IMetaObject its members can be retrieved.


do you mean a xpath query in java? like:

String startKaderXpath = "//"+FinancieelKader.getType()+"" +
"[Tegenvoorstel2010.FinancieelKader_Zorgaanbieder = '"+zorgaanbieder.getGUID()+"']" +

List<IMendixObject> startKaderList = Core.retrieveXPathQuery(context, startKaderXpath);

Your question is a bit unclear to me.