Page 1 of 1

How to obtain a property's templated type?

PostPosted: Thu Feb 21, 2019 2:39 pm
by thomas.beale@openehr.org
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