Java: Convert String to org.eclipse.uml2.uml.Type
-
17-06-2021 - |
Pregunta
Is it possible to convert a String to a type, which is definied by org.eclipse.uml2.uml.Type? We need this information to generate a uml file with emf and ecore, but we only get the type information as a String.
Thank you!
Solución
As you wrote in your comments, your problems is NOT getting a UML type for a qualified method name-you apparently want to create the UML which corresponds to your KDM!
Either you turn you KDM into a UML model manually, drawing the class diagram in a suitable editor, or you do it programmatically. There, you'd start with a (empty) UML model, and add (create) all the (UML) classes to it that you need (e.g. through Package.createOwnedClass(name, isAbstract) : Class
.
From looking at the class hierarchy, you can see that a Class
is also a Type
. You know the root of your model (a package), you know where you put the classes (maybe in a subpackage), so you know where to look by name for a particular class using Package.getOwnedType(name) : Type
.