How to obtain a property's templated type?

MagicDraw OpenAPI, scripting related questions and discussions

Moderator: Moderators

How to obtain a property's templated type?

Postby thomas.beale@openehr.org » Thu Feb 21, 2019 2:39 pm

We have an extractor using the openAPI; to obtain the type of a property in a model, we use property.getType().getName().
However, if the property type is generic (templated) e.g. something like the property 'events' below (pseudo-code)

class History<T> {
events: Event<T> [*]
}

getType().getName() doesn't return 'Event<T>', only 'Event'. Apparently 'Type' doesn't mean what it should mean in the UML meta-model...

I've tried a number of things to obtain the proper type name, including template parameters part (i.e. '<T>' or '<V,K>' etc), but no luck so far.

Does anyone here know which functions to use to obtain the full type?

thanks
- thomas
thomas.beale@openehr.org
Forum Newbie
Forum Newbie
 
Posts: 3
Posts Rating:0
Joined: Wed Oct 12, 2016 11:19 am

Return to Programmatic Extendibility

Who is online

Users browsing this forum: No registered users and 0 guests