|
Re: How to specify the Type of an attribute programmatically? [message #1734008 is a reply to message #1734002] |
Fri, 03 June 2016 00:47  |
|
Hi,
This question would properly belong in the uml2 forum, but in any case
it's a pretty generic question of having references to model elements
in an EMF-based model.
If you want to create an attribute of a particular type, don't you know
that type a priori? You should already have a reference to some
instance of the org.eclipse.uml2.uml.Type interface. Otherwise, why
are you creating the attribute?
The API you're using is just like any other Java API. The arguments to
an operation like Package::createOwnedClass(...) are just references to
objects as usual in Java.
Perhaps I don't understand the question.
Christian
On 2016-06-02 21:21:11 +0000, Syed Samsul Arefin said:
> I asked this question in EMF forum but I think MDT is the right place
> to ask this. Maybe it's a trivial question.
> While creating the attribute programmatically how do I specify the Type
> of the attribute?
>
> Package model = UMLFactory.eINSTANCE.createPackage();
> model.setName("MyPackage");
> Class cls = model.createOwnedClass("MyClass", false);
> Property p =cls.createOwnedAttribute("Attr1","???");
>
> Any suggestion?
|
|
|
Powered by
FUDForum. Page generated in 0.01720 seconds