Java
Last updated
Last updated
Zontroy Generator is a developer tool for generating source code. Zontroy is compatible with Java and all Java frameworks. You can generate Java code using Zontroy IDE or command line of any known IDE such as Visual Studio Code, Eclipse or Netbeans.
Zontroy can be used for any kind of java project. For our example, we are going to generate a sample code. Let’s write a java controller class as a sample and generate other classes we need using the sample class.
By modifying the code as shown below, we can generate other classes we need.
Let’s look at the details:
1. Go to File -> New Project.
2. Fill in the form with the required project details. PostgreSQL and Pagila Database is used at this sample. Pagila Database is available on github. If you like, you can use Oracle, MySQL or MSSQL databases as well with the same code sample. Java is selected as the programming language and the project name is given. Location is the directory on our pc.
3. We need to add a template file in order to generate code. These template files are required and function as the input for Zontroy. We add a zref (Zontroy Repeating File) to the project for this example.
4. Name the file as below to create a code file for each entity. It refers to the name of each entity based on our database or entity repository. Other predefined properties of an entity is defined in our documentation section.
5. Write the generation code in zref. All of the keywords begin with “zg-” prefix. In this way, you don’t need to split your code using quotes, double quotes or any other character. [[[zg-entity…zg-name]]] will be replaced with the name of the entity by Zontroy Interpreter. There are plenty of built-in functions to use in our library such as “zg-lowerFirstCase”. Detailed information about built-in functions are provided on our Docs pageDocs page.
6. Generate other files and source code.
7. Review the generated code. Generation process is completed at this step. We have generated 21 code files with their implemented code in seconds.
This is a sample application on using Zontroy as a Java Code Generator. You can generate any type of code files in this way, even a javascript file or typescript file.
Zontroy is a very flexible tool to use for any layer of your multi-tier applications. It doesn’t matter if your project is a desktop, web or mobile application. You can develop code like a development team by yourself using Zontroy.
Good to know: You can generate Java code using Zontroy.