list of dots Digital Research Alliance of Canada logo  NSERC logo  University of Ottawa logo / UniversitĂ© d'Ottawa

User Manual    [Previous]   [Next]   

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()
@SuppressWarnings("deprecation")
class Student
{
  Integer id;
  String name;
  trace id;
  trace set name;
}

      

Load the above code into UmpleOnline

 

Another Example

// This traces  getId() method
@SuppressWarnings("deprecation")
class Student
{
  Integer id;
  trace get id;
}
// @@@skipphpcompile See issue 596 (PHP tracing causes issues)

      

Load the above code into UmpleOnline

 

Another Example

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

      

Load the above code into UmpleOnline

 

Syntax


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

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