cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Java way to obtain an object's stereotype

william_huart
Contributor

Hello,

 

I've been using the Java API a lot and it went ok for every kind of object I was reading until now, I'm trying to get the stereotype of an object (let's say a Dependency has a stereotype called Lambda)

I wrote the same code I usually use in those cases :

 

MegaCollection stereotypes = dependency.getCollection(Dependency.MAE_Stereotype);

When I check for the collection size (stereotypes.size()), then I get the correct amount which is 1.

 

However, I cannot find a way to get the name of this stereotype, as there is no Stereotype class in my mega vocabulary to get the field id from

Even the stereotypes.get(0).megaField() seems to fail, returning ~000000000000[<Empty Object>]

 

How can I get the stereotype name of my dependency ?

 

Sincerely,

William

1 Reply

william_huart
Contributor

The problem was that the stereotype collection starts at index 1 and not 0 as it is implemented 99% of the time in array structures,

Sincerely