Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » How to create programatically un object of given DataType
How to create programatically un object of given DataType [message #1073721] Thu, 25 July 2013 11:22
hongyu liu is currently offline hongyu liuFriend
Messages: 6
Registered: March 2012
Junior Member
Need:

Given a UML self-defined DataType, not UML pre-defined DataType (e.g. MyType), how to create its instance programatically?

Use case:

In a UML profile, we define a stereotype which has some attributes of MyType. In order to specify a UML model correctly, we need to create an instance of MyType after we apply the stereotype.

Example Pseudo Code:

Element target;
Stereotype st = getStereotypeByName("name");
target.applyStereotype(st);

DataType dt = getDataTypeByName("MyType");

EObject instance = createInstance(dt);


target.setValue(st, "myTypeAttr", instance);


Question:

How this method "EObject createInstance(DataType dt)" can be implemented ?


Thanks in advance.
Previous Topic:How to keep stereotypeApplications while moving an object
Next Topic:Control and Object flow in Activity Model
Goto Forum:
  


Current Time: Sun Dec 21 18:13:13 GMT 2014

Powered by FUDForum. Page generated in 0.01535 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software