Customizing getter and setter body

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
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
    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
    Customizing the setter of attribute
    When you generate code, you will see the entered code appended to the generated getter or setter.
    Customized setter
    Customized setter

Related Resources

The following resources may help you to learn more about the topic discussed in this page.

 
4. Using generated code Table of Contents Chapter 7. State Machine Diagram Code Generation
 

Technical Support

Have technical issues or suggestions? Please contact Visual Paradigm Support Team.

Sales Support

Have questions related to registration, licensing or payment? Feel free to contact Visual Paradigm Sales Team.

Discussion Forum

Share your suggestions of opinions at VP Discussion Forum.