uOttawaUniversity of Ottawa - Canadas University
list of dots

Umple User Manual    [Previous]   [Next]   

Loading

E213 Bidirectional Association in Traits

Umple semantic error related to having bidirectional association with interfaces

Traits can make associations with interfaces, classes, and template parameters. If one end of the association is a template parameter, the binding type must be checked to make sure it is compatible with the type of the association. For example, if a trait has a bidirectional association with a template parameter, the binding value cannot be an interface and it must be a class. Breaking this constraint is reported to modelers using this error code.

Example

// In this example, there is an error because a bidirectional association is created with interface I, which is not valid.
interface I {
  /*implementation*/
}
trait T <RelatedClass> {
  0..1 -- * RelatedClass;
  /*implementation*/
}
class C{
 isA T<RelatedClass=I>;
 /*implementation*/
}









      

Load the above code into UmpleOnline