Property type field not populated for UML PrimitiveType in Xpand

I have an XPT template that generates text from a UML model. This is the excerpt I use for class attributes.

«FOREACH attribute AS a» Id: «a.name» Type: «a.type.name» «ENDFOREACH» 

Everything works well, while type is a class from the model itself. But if it is a primitive type, then all fields, including name , are set to null . If I change «a.type.name» to «a.type» then the answer will be something like this:

 org.eclipse.uml2.uml.internal.impl.PrimitiveTypeImpl@6e315086 (eProxyURI: pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String) 

The debugger shows that only a private eStorage field is specified on the object, so toString() displays the result above.

Interestingly, the same expression in Acceleo evaluates correctly:

 [query public getType(t : Type) : String = t.name /] 

Question: how can I get the type attribute field for uml primitive types in Xtend?

EDIT: The problem narrowed down to this question: EProxy URI does not resolve in ecore model

+4
source share
1 answer

The code generated by Acceleo can resolve unusual pathmap:// eProxyURI. By default, a simple Xpand template or Xtend code cannot resolve them. See this question for more details and solutions.

+1
source

Source: https://habr.com/ru/post/1486019/


All Articles