Consider the following example.
#Example; Gaphor factory.
from gaphor.application import Application
from gaphor.UML.elementfactory import ElementFactory
from gaphor.UML.uml2 import Class
if __name__=="__main__":
factory_obj=ElementFactory()
factory_obj.init(Application)
class_obj=factory_obj.create(Class)
class_obj.name="MyClass"
print class_obj.name
print class_obj.id
class_obj.unlink()
factory_obj.shutdown()
We can construct any UML element from the Gaphor uml2 module which is automatically generated. Very neat stuff.
No comments :
Post a Comment