list of dots

User Manual    [Previous]   [Next]   

Tracing Associations

Associations describe the relationships between class instances; role names are used to clarify the relation at both ends of an association. MOTL allows the tracing of associations by referring to the role names. Tracing can occur whenever an association link is added or deleted at run time:

  • add: When the "add" keyword is specified before the traced assoc role name, tracing occurs when an association link is being added.
  • remove: When the "remove" keyword is specified before the traced assoc role name, tracing occurs when an association link is being deleted.

Example

// This example will record any addition/removal
// to supervisor assoc link 

class Student {
  Integer id;
}

class Professor {
  1 -- * Student supervisor;
  
  trace supervisor;
}

// @@@skipphpcompile See issue 596 (PHP tracing causes issues)
      

Load the above code into UmpleOnline

 

Another Example

// This example will record any addition to
// assoc link 'supervisor'

class Student {
  Integer id;
}

class Professor {
  1 -- * Student supervisor;
  
  trace add supervisor;
}

// @@@skipphpcompile See issue 596 (PHP tracing causes issues)
      

Load the above code into UmpleOnline

 

Another Example

// This example will record any removal of any
// supervisor assoc link 

class Student {
  Integer id;
}

class Professor {
  1 -- * Student supervisor;
  
  trace remove supervisor;
}

// @@@skipphpcompile See issue 596 (PHP tracing causes issues)
      

Load the above code into UmpleOnline

 

Syntax


traceDirective : trace [[Prefix]]? [[traceEntity]] [[Postfix]] ;

traceEntity- : [traceEntity] (()? ())? ( , [traceEntity] (()? ())? )*