JAVA UML Interface multi inheritance bug or mistake?
-
28-05-2021 - |
質問
I tried to made it as simple I could. I wonder me about a graph generated by Ess Model that miss (at my opinion) the display of the linkage between two interfaces in the UML graph.
I'm pretty new to java and UML, so perhaps it's my fault but I want to be sure to not miss this basic stuff... How should be the correct UML graph to display the following code:
-I--> interface IHave_an_x
int getx();
void setx(int x);
-I--> interface IHave_an_y
int gety();
void sety(int y);
-I--> interface IHave_an_x_AND_an_y extends IHave_an_x, IHave_an_y
//.. no code comes here
-O--> class Object_have_xy implements IHave_an_x_AND_an_y
int getx(){
return this.x;
}
void setx(int x){
this.x = x;
}
int gety(){
return this.y;
}
void sety(int y){
this.y = y;
}
-O--> class ObjectNeeds_xy_inConstructor
public ObjectNeeds_xy_inConstructor (Object_have_xy obj_xy){
System.out.println("obj_xy...");
System.out.println("valueof x = " + obj_xy.getx());
System.out.println("valueOf y = " + obj_xy.gety());
}
This is the graph generated by Ess Model (is it normal to not represent the linkage with interface IHas_a_property_y in the UML or a bug): And this is normally what I expected to be (what I think it should be):
解決
Since you clearly extend both interfaces in the code, that link should appear in the UML diagram (otherwise code generated from the UML can access sety
only via Object_have_xy
, but not via IHave_an_y
) So assuming the pictures are correct, this is a bug.