Modeling Tools

This functionality is available in Standard, Professional, Architect and Enterprise editions only.

Setters and Getters are common operations that contain almost every Class. With the help of our modeling tool, set and get operations for Class attributes can be generated automatically.


To create a setter or a getter


There are two ways of creating a setter or a getter:

  1. From the shortcut menu of the selected Class, select Tools, and then select Create Setters/Getters.
    1. The Select Attributes/Association Ends dialog opens.
  2. Add a tagged value "getter/setter for attribute=attribute_name" to the selected Class.


The names of created operations (setters) are combined according to the following format:

public void set + <attribute name> (<attribute type> <attribute name>) 

Example

If you have an attribute called x of type int, then the generated setter will look this way:

  • public void setx (int x);


The names of created operations (getters) are combined according to the following format:

public <attribute type> get + <attribute name> ( ) 

Example

If you have an attribute called x of type int, then the generated getter will look this way:

  • public int getx ();



Related Pages