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.
Instant generator allows you to generate programming source code from class models. Basically, the content of the generated code follows the common coding convention of the programming language. There are also advanced options for you to configure some of the specific settings in forming the code, like the use of prefix for attributes and parameters.
Although the built-in way of generating source code can satisfy most of the general needs, you may want to define something more specific. For example, you may need to print a copyright statement at the beginning of the code file, which is not a kind of customization being supported by Instant generator.
Fortunately, the way of how source code will be generated is handled by Apache Velocity engine, a templating engine, and the templates being used are fully opened for customization. In the following sections, we will explain how to customize a template to make the generated code follow your requirement.
The customization of template requires the use of a text editor. A suggestion of text editor would be JEdit, a powerful, yet free of charge text editor. More important, it provides syntax highlighting, which helps you read the template content easier by styling different parts with different colors. You can download JEdit from its official site at:
http://www.jedit.org/
To install JEdit:
The template files are put under the resources/instantgenerator folder of VP Suite installation directory. It is absolutely alright to edit those files directly. However, it is recommended to setup your own development environment, copy the template files to there to perform further editing. There are two reasons for separating the development environment from VP Suite:
To setup your development environment:
![]() |
| Copy folder |
By having the text editor and the development environment ready, it’s time to get your hand dirty with editing the template. As mentioned before, Instant generator adopted the Apache Velocity engine in generating source code. For those who are interested in knowing how to write templates, please read Velocity’s Users’ guide at:
http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html.
The following example demonstrates how to edit the PHP code generation template to reposition the brace of operation blocks to a new line.
![]() |
| Customization of operation in PHP class |
![]() |
| Open PhpOperation.vm in text editor |
![]() |
| Search for the open branch |
![]() |
| Insert line breaks |
![]() |
| Add variable |
To generate code with customized template:
![]() |
| Specifying template directory |
The following table lists the available API calls for retrieving data from models.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| A list of API calls |
The following lists the syntax that of statements that can be used in the template.
| 16. Instant Generator for Ruby | Table of Contents | Chapter 3. Java Round-Trip |
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.