uOttawaUniversity of Ottawa - Canadas University
list of dots

Umple User Manual    [Previous]   [Next]   

Loading

Tracing Attributes

MOTL allows the tracing of attributes at the model level. Attribute tracing can occur whenever an attribute value is changed (i.e. setter is called) or/and when the value is accessed (i.e. the getter method is called). Thus, attribute tracing can be made to occur any of the following modes:

  • set: When the "set" keyword is specified before the traced attribute, tracing occurs when the attribute setter method is executed. This is also the default when no keyword is specified before the attribute
  • get: When the "get" keyword is specified before the traced attribute, tracing occurs when the attribute setter method is executed
  • set,get: When "set,get" is specified tracing occurs when both the getter and setter method are executed.

Example

// This traces setId() and setName()
class Student
{
  Integer id;
  String name;
  trace id;
  trace set name;
}


      

Load the above code into UmpleOnline

 

Another Example

// This traces  getId() method
class Student
{
  Integer id;
  trace get id;
}

      

Load the above code into UmpleOnline

 

Another Example

// This example traces getId() and setId()
class Student
{
  Integer id;
  trace set,get id;
}


      

Load the above code into UmpleOnline

 

Syntax


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

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