Storyboard GenericObjectDiagram
Start situation: we do not yet have a class diagram but want to start with some example object models
Step 1: We build a generic class model for object structures:
Step 2: We just build our example object structure with generic objects:
Step 3: Then we tune our diagram dumper to show it as a non-generic object diagram:
Step 4: now we try to learn a class diagram from the generic object structure:
Step 5: generate model creation code to allow the developer to adjust e.g. attribute types and associoation cardinalities:
ClassModel model = new ClassModel("org.sdmlib.test.examples.roombook"); Clazz buildingClass = model.createClazz("org.sdmlib.test.examples.roombook.Building") .withAttribute("name", DataType.STRING); Clazz floorClass = model.createClazz("org.sdmlib.test.examples.roombook.Floor") .withAttribute("level", DataType.INT) .withAttribute("name", DataType.STRING) /*add attribut*/ .withAttribute("guest", DataType.STRING); /* add assoc */ buildingClass.withBidirectional(floorClass, "has", Cardinality.MANY, "buildings", Cardinality.ONE); // FIXME: Alex // learnedModel.getGenerator().insertModelCreationCodeHere("examples");
Step 6: generate code from the learned class diagram
Step 7: derive non-generic objects from the generic objects