create link model between instance specification of Person and Car Creating Link between Instance SpecificationĪfter both Instance Specification being created, we can then create a link between them. OK, now it’s your turn to create Instance Specification for the Car class. tRequestResetCaption(true) // set to automatic calculate the initial caption position tBounds(100, 105, 110, 45) // specify the location for instance specification of Person IInstanceSpecificationUIModel objPersonShape = (IInstanceSpecificationUIModel) diagramManager.createDiagramElement(diagram, objPerson) create view for instance specification of Person on diagram ObjPerson.addSlot(slotPersonName) // add the slot to Person instance specificationĪfter the Instance Specification model is created, we can then create a view for it in our diagram. SlotPersonName.addValue(valueSpecPersonName) // add value specification to slot ICompositeValueSpecification valueSpecPersonName = IModelElementFactory.instance().createCompositeValueSpecification() create value specification for the slot tFeature(attrPersonName) // specify the slot is reference to the name attribute of Person class ISlot slotPersonName = IModelElementFactory.instance().createSlot() create slot for name attribute of Person instance specification Once the Instance Specification is being created, we can then define the slot to represent the features in the Instance Specification. ObjPerson.addClassifier(classPerson) // specify base classifier for the instance specification tName("John Doe") // specify the name of the instance specification model IInstanceSpecification objPerson = IModelElementFactory.instance().createInstanceSpecification() create instance specification model for Person Next we try to create the Instance Specification. IObjectDiagramUIModel diagram = (IObjectDiagramUIModel) diagramManager.createDiagram(IDiagramTypeConstants.DIAGRAM_TYPE_OBJECT_DIAGRAM) Creating Instance Specification and Slots We can use the DiagramManager.createDiagram to create a blank object diagram: // create blank object diagramĭiagramManager diagramManager = ApplicationManager.instance().getDiagramManager() Now we are ready to create our Object Diagram. IAssociation association = IModelElementFactory.instance().createAssociation() ĪtTo(classCar) Create Blank Object Diagram create association between Person and Car IAttribute attrCarType = classCar.createAttribute() Īfter create the classes we then create an association between the 2 classes. IAttribute attrCarBrand = classCar.createAttribute() IClass classCar = IModelElementFactory.instance().createClass() IAttribute attrPersonName = classPerson.createAttribute() ĪtType("String") // create base classifiers Car and its attributes IClass classPerson = IModelElementFactory.instance().createClass() create base classifiers Person and its attribute We only need to create them in model repository and there is no need to create them into diagram. Let’s start by create the base classifiers for our Instance Specification. Each Instance Specification have the slot defined reflect the features on the base classifier. It only have 2 Instance Specification and a link between them. This is the object diagram we are going to create. Object Diagram which we are going to create via Open API
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |