cancel
Showing results for 
Search instead for 
Did you mean: 

MegaObject in Java

SOLVED
Highlighted
Contributor

MegaObject in Java

In java API, how do I know what metaClass a MegaObject represents? Also how do I find its short name? How do I traverse its relations with other objects? (like Meta Associations)?

 

I tried this but I am not sure if this is the right usage:

 

MegaObjectProperty prop = new MegaObjectProperty(object.megaField(),"~Z20000000D60[Short Name]");
       

Tags (4)
6 REPLIES
Contributor

Re: MegaObject in Java

Hi, 

 

How do I know what metaClass a MegaObject represents : 

 

myMegaObject.getClassObject();

 

How do I find its short name : 

 

myMegaObject.getProp("~Z20000000D60[Short Name]");

 

I don't get the last question =/

 

I hope it helps !

 

 



Patrick Bobo
Contributor

Re: MegaObject in Java

is the Shortname attribute identifier the same for every metaobject?

 

I have generated identifiers for java Components for Meta Classes:City Plan, City Planning Area and Criteria. I dont see Short Name being available in the Vocab that mega generates.

I only see the following:

 

String id = object.getProp(CityPlanningArea.ID);
String name = object.getProp(CityPlanningArea.MA_ConvertedNameVersion);

 

When I run them in Eclipse debug, these 2 statements fail.

 

 

Contributor

Re: MegaObject in Java

Yes, the identifier is the identifier of the MetaAttribute Short Name, so it will always be the same. 

 

Short Name is not always displayed as a MetaAttribute of a MetaClass, but is available for all of them. 

Try : cityPlan.getProp("Short Name"); and you might see it.

 

 

Hmm, I can't help you with that much information. What is contained in : CityPlanningArea.ID and in CityPlanningArea.MA_ConvertedNameVersion ? 



Patrick Bobo
Contributor

Re: MegaObject in Java

P

 

What I meant to as was - would this be the same for all meta classes: ~Z20000000D60[Short Name]?

 

I was expecting to see an attribute for short name inside generated vocabulary classes for each meta classes, but it doesnt seem to be the case. So I was a little confused.

Contributor

Re: MegaObject in Java

My answer is still the same. The identifier you provide in "getProp" is the identifier of the MetaAttribute Short Name. As a result, it's the same identifier no matter the MetaClass you're using. 

 

I know that all the MetaClass don't show the MetaAttribute Short Name, but it exists for all of them for what I know. 



Patrick Bobo
Contributor

Re: MegaObject in Java

Thanks for the quick response!