Here is an example of how we can initialize an ElementFactory instance.
from gaphor.UML.elementfactory import ElementFactory
from gaphor.UML import Class
if __name__=='__main__':
 factory_obj=ElementFactory()
 print 'Factory initialized with %s elements.'%(factory_obj.size()) 
We can then use this ElementFactory instance to create new UML elements as illustrated below.
    class_obj=factory_obj.create(Class)
  print 'Class object created with ID: %s'%(class_obj.id)
No comments :
Post a Comment