Chapter 25. Code Engineering

  1. Home
  2. Docs
  3. Chapter 25. Code Engineering
  4. 5. Object Relational Mapping
  5. Customizing getter and setting body

Customizing getter and setting body

Download PDF

In generated ORM code, getters and setters will be generated for attributes added to every ORM Persistable class. Sometimes, you may want to customize the method body of those getters and setters, like to apply security checking or to print a statement upon the updating of data. In these cases, you can customize the getter and setter of attribute to add the code you want.
A part of the generated code, showing the getters and setters generated from attributes of an ORM Persistable class
To customize getter/setter of attribute:

  1. Right click on the attribute that you want to customize its getter or setting and select Open Specification… from the popup menu.
    Opening the specification of attribute
  2. Open the ORM Attribute Detail tab and enter the code body in Getter/Setter code sections.
    Customizing the setter of attribute
    When you generate code, you will see the entered code appended to the generated getter or setter.
    Customized setter