Zontroy Generator Documentation
Welcome to Zontroy Generator !
Zontroy Generator is a technology to generate source code.
Zontroy is compatible with all programming languages and common databases. In addition you can generate source code based on Entity Classes. Zontroy has 3 file types to generate code according to your need.
Zontroy has own IDE and can be used with popular IDEs like Visual Studio Code.
Zontroy can be used with version control systems like git, tfs, svn etc. Zontroy can be used with a custom framework.
Teams and individual developers can use Zontroy.
Zontroy has a marketplace where you can find free or paid templates which are
basically frameworks written in different programming languages and converted to generation template using Zontroy.
Zontroy is not a low code platform and not produces codes of a standard platform. Source code always provided to developer as an output.
Source code generation lots of advantages such as providing coding standards and minimizing error.
Maximazing the benefit of source code generation we need an approach. We named this approach as Generation Oriented Programming (GOP).
Generation Oriented Programming should include sets of rules and procedures.
- Design your data source and software
- Create a prototype or sample considering generation process
- Convert prototype to code generation template
- Generate-Develop in a loop
Zontroy Language
Zontroy Language is a code generation language written inside other source code lines and generates source code. Zontroy code written in zref, zsif and ziref code files and interpreted by Zontroy Interpreter.
Zontroy IDE
Zontroy IDE provides a platform to create code generation projects and generate source code targetting all programming languages! Additionally, developers can find lots of templates written in Zontroy Language ready to generate and run.
Zontroy Console
Zontroy Console provides a platform to create code generation projects and generate source code targetting all programming languages on command prompt! Additionally, developers can use Zontroy Console while working with popular IDEs like Visual Studio Code.
// create a local project
zontroy -create -type=VALUE -server=VALUE -database=VALUE -user=VALUE -password=VALUE -language=VALUE -name=VALUE -path=VALUE
// sample usage :
zontroy -create -type=Entity|MSSQL|MySQL|Oracle|PostgreSQL -server=.\ -database=ZontroyTrade -user=sa -password=12345 -language=CSharp|Go|Java|Javascript|PHP|Python|R|Swift|TypeScript|VB.Net|Other|Another -name=MyZontroyProject -path=D:\test\console\
// create a project from an online template
zontroy -create-online -type=VALUE -server=VALUE -database=VALUE -user=VALUE -password=VALUE -language=VALUE -name=VALUE -path=VALUE -template=VALUE
// sample usage :
zontroy -create-online -type=Entity|MSSQL|MySQL|Oracle|PostgreSQL -server=.\ -database=ZontroyTrade -user=sa -password=12345 -language=CSharp|Go|Java|Javascript|PHP|Python|R|Swift|TypeScript|VB.Net|Other|Another -name=MyZontroyProject -path=D:\test\console\ -template=SpringBootAngularCRUD
// open a project
zontroy -open -path=VALUE
// sample usage :
zontroy -open -path=D:\test\console\MyZontroyProject\MyZontroyProject.zproject
// generate all zontroy files
zontroy -generate -all [-watchgeneration=VALUE]
// sample usage :
zontroy -generate -all -watchgeneration=64x
// generate a specific zontroy file
zontroy -generate -filepath=VALUE
// sample usage :
zontroy -generate -filepath=D:\test\console\MyZontroyProject\Controller\MyFile.java
// include all entities and fields
zontroy -include -all
// sample usage :
zontroy -include -all
// include an entity and its fields
zontroy -include -name=VALUE
// sample usage :
zontroy -include -name=dbo.Posts
// exclude all entities and fields
zontroy -exclude -all
// sample usage :
zontroy -exclude -all
// exclude an entity and its fields
zontroy -exclude -name=VALUE
// sample usage :
zontroy -exclude -name=dbo.Posts
Syntax
Variables and keywords starts with zg- prefix in Zontroy Language.The parentheses, square brackets and other characters are used in three in order to distinguish Zontroy codes inside other codes.
zg-entities
zg-entities is a predefined collection of reference objects for entities generated by using a Zontroy Repeating File. It is possible to iterate entities inside a for loop to generate code using entity references.
zg-for(((zg-item:::[[[zg-entites]]]))){{{
// [[[zg-item...zg-name]]]
}}}
zg-entity
zg-entity is a reference object for an entity. The properties of this object which are predefined in Zontroy are accessible and as follows:
[[[zg-entity...zg-fields]]]
[[[zg-entity...zg-pkFields]]]
[[[zg-entity...zg-referencingFields]]]
[[[zg-entity...zg-referencedFields]]]
[[[zg-entity...zg-schema]]]
[[[zg-entity...zg-name]]]
[[[zg-entity...zg-targetName]]]
[[[zg-entity...zg-alternativeName]]]
[[[zg-entity...zg-label]]]
[[[zg-entity...zg-rowOrder]]]
[[[zg-entity...zg-description]]]
[[[zg-entity...zg-displayFields]]]
[[[zg-entity...zg-extra1]]]
[[[zg-entity...zg-extra2]]]
[[[zg-entity...zg-extra3]]]
[[[zg-entity...zg-extra4]]]
[[[zg-entity...zg-extra5]]]
[[[zg-entity...zg-extra6]]]
[[[zg-entity...zg-extra7]]]
[[[zg-entity...zg-extra8]]]
[[[zg-entity...zg-extra9]]]
zg-field
zg-field is defined using fields of an entity by custom variable name and predefined properties are as follows:
[[[zg-field...zg-name]]]
[[[zg-field...zg-targetName]]]
[[[zg-field...zg-alternativeName]]]
[[[zg-field...zg-label]]]
[[[zg-field...zg-rowOrder]]]
[[[zg-field...zg-description]]]
[[[zg-field...zg-dataType]]]
[[[zg-field...zg-targetType]]]
[[[zg-field...zg-extra1]]]
[[[zg-field...zg-extra2]]]
[[[zg-field...zg-extra3]]]
[[[zg-field...zg-extra4]]]
[[[zg-field...zg-extra5]]]
[[[zg-field...zg-extra6]]]
[[[zg-field...zg-extra7]]]
[[[zg-field...zg-extra8]]]
[[[zg-field...zg-extra9]]]
zg-for
zg-for is a loop to iterate entities and fields.
zg-for((([variable]:::[predefined_collection]))){{{
}}}
Sample
Entity Names:
zg-for(((zg-item:::[[[zg-entities]]]))){{{
[[[zg-item...zg-name]]]
}}}
Field Names:
zg-for(((zg-item:::[[[zg-fields]]]))){{{
[[[zg-item...zg-name]]]
}}}
zg-if
zg-if is a condition to check a state.
zg-if((([variable1]===[variable2]))){{{
//Variables are equal.
}}}
Zontroy Repeating File (zref)
This file type is used to generate separate code files with lines of code in them. Our code files use the same extension which is zref for different languages, but before zref extension we should also use the original file extension as below:
[file_name].[file_extension].zref
Sample
[[[zg-entity...zg-name]]].java.zref
Example 1
Assume that we use a database with tables : TableA, TableB, TableC, …, TableZ
Java
Input
// My[[[zg-entity...zg-name]]].java.zref
public class My[[[zg-entity...zg-name]]] {
}
Output
// MyTableA.java
public class MyTableA {
}
// MyTableB.java
public class MyTableB {
}
// MyTableC.java
public class MyTableC {
}
...
// MyTableZ.java
public class MyTableZ {
}
C#
Input
// My[[[zg-entity...zg-name]]].cs.zref
public class My[[[zg-entity...zg-name]]] {
}
Output
// MyTableA.cs
public class MyTableA {
}
// MyTableB.cs
public class MyTableB {
}
// MyTableC.cs
public class MyTableC {
}
...
// MyTableZ.cs
public class MyTableZ {
}
Python
# My[[[zg-entity...zg-name]]].py.zref
class My[[[zg-entity...zg-name]]]:
# MyTableA.py
class MyTableA:
# MyTableB.py
class MyTableB
# MyTableC.py
class MyTableC:
...
# MyTableZ.py
class MyTableZ:
Example 2
Assume that we use a database with tables : Table1, Table2, Table3, …, Table100 and each table has an id column and name column that has a name ending with its number.
Java
Input
// Your[[[zg-entity...zg-name]]]Class.java.zref
public class Your[[[zg-entity...zg-name]]]Class {
// Columns :
zg-for(((zg-item:::[[[zg-entity...zg-fields]]]))){{{
// [[[zg-item...zg-name]]]
}}}
}
Output
// YourTable1Class.java
public class YourTable1Class {
// Columns :
// Id
// Name1
}
// YourTable2Class.java
public class YourTable2Class {
// Columns :
// Id
// Name2
}
// YourTable3Class.java
public class YourTable3Class {
// Columns :
// Id
// Name3
}
...
// YourTable100Class.java
public class YourTable100Class {
// Columns :
// Id
// Name100
}
C#
Input
// Your[[[zg-entity...zg-name]]]Class.cs.zref
public class Your[[[zg-entity...zg-name]]]Class {
// Columns :
zg-for(((zg-item:::[[[zg-entity...zg-fields]]]))){{{
// [[[zg-item...zg-name]]]
}}}
}
Output
// YourTable1Class.cs
public class YourTable1Class {
// Columns :
// Id
// Name1
}
// YourTable2Class.cs
public class YourTable2Class {
// Columns :
// Id
// Name2
}
// YourTable3Class.cs
public class YourTable3Class {
// Columns :
// Id
// Name3
}
...
// YourTable100Class.cs
public class YourTable100Class {
// Columns :
// Id
// Name100
}
Python
# Your[[[zg-entity...zg-name]]]Class.py.zref
class Your[[[zg-entity...zg-name]]]Class:
# Columns :
zg-for(((zg-item:::[[[zg-entity...zg-fields]]]))){{{
# [[[zg-item...zg-name]]]
}}}
# YourTable1Class.py
class YourTable1Class:
# Columns :
# Id
# Name1
# YourTable2Class.py
class YourTable2Class:
# Columns :
# Id
# Name2
# YourTable3Class.py
class YourTable3Class:
# Columns :
# Id
# Name3
...
# YourTable100Class.py
class YourTable100Class:
# Columns :
# Id
# Name100
Zontroy Single File (zsif)
This file type is used to generate lines of code in a single file. Our code files use the same extension which is zsif for different languages, but before zsif extension we should also use the original file extension as below:
[file_name].[file_extension].zsif
Sample
MyCodeFile.java.zsif
Example 1
For this example, we are going to produce empty classes.
Java
Input
// MyClass.java.zsif
public class MyClass {
}
Output
// MyClass.java
public class MyClass {
}
C#
Input
// MyClass.cs.zsif
public class MyClass {
}
Output
// MyClass.cs
public class MyClass {
}
Python
# MyClass.py.zsif
class MyClass:
# MyClass.py
class MyClass:
Example 2
Let’s assume we use a database with tables : Table1, Table2, Table3, …, Table100 this time.
Java
Input
// MyClass.java.zsif
public class MyClass {
zg-for(((zg-item:::[[[zg-entity...zg-fields]]]))){{{
class Nested[[[zg-item...zg-name]]] {
}
}}}
}
Output
// MyClass.java
public class MyClass {
class NestedTable1 {
}
class NestedTable2 {
}
class NestedTable3 {
}
…
class NestedTable100 {
}
}
C#
Input
// MyClass.cs.zsif
public class MyClass {
zg-for(((zg-item:::[[[zg-entity...zg-fields]]]))){{{
class Nested[[[zg-item...zg-name]]] {
}
}}}
}
Output
// MyClass.cs
public class MyClass {
class NestedTable1 {
}
class NestedTable2 {
}
class NestedTable3 {
}
…
class NestedTable100 {
}
}
Python
# MyClass.py.zsif
class MyClass:
zg-for(((zg-item:::[[[zg-entity...zg-fields]]]))){{{
class Nested[[[zg-item...zg-name]]]:
}}}
# MyClass.py
class MyClass:
class NestedTable1:
class NestedTable2:
class NestedTable3:
…
class NestedTable100:
Zontroy Inner Repeating File (ziref)
This file type is used to generate separate folders with code files in them. The code files also have lines of code in them. Our code files use the same extension which is ziref for different languages, but before ziref extension we should also use the original file extension as below:
[folder_name].ziref
[file_name1].[file_extension1].ziref
[file_name2].[file_extension2].ziref
…
Sample
My[[[zg-entity...zg-name]]]Folder.ziref
MyClass1.java.ziref
MyClass2.java.ziref
…
Example 1
Assume that we use a database with tables : TableA, TableB, TableC, …, TableZ
Java
Input
// Folder : My[[[zg-entity...zg-name]]].ziref
// File inside the folder : MyClass.java.ziref
public class MyClass {
}
Output
// Created folder : MyTableA
// Created file inside the folder : MyClass.java
public class MyClass{
}
// Created folder : MyTableB
// Created file inside the folder : MyClass.java
public class MyClass{
}
// Created folder : MyTableC
// Created file inside the folder : MyClass.java
public class MyClass{
}
...
// Created folder : MyTableZ
// Created file inside the folder : MyClass.java
public class MyClass{
}
C#
Input
// Folder : My[[[zg-entity...zg-name]]].ziref
// File inside the folder : MyClass.cs.ziref
public class MyClass {
}
Output
// Created folder : MyTableA
// Created file inside the folder : MyClass.cs
public class MyClass{
}
// Created folder : MyTableB
// Created file inside the folder : MyClass.cs
public class MyClass{
}
// Created folder : MyTableC
// Created file inside the folder : MyClass.cs
public class MyClass{
}
...
// Created folder : MyTableZ
// Created file inside the folder : MyClass.cs
public class MyClass{
}
Python
# Folder : My[[[zg-entity...zg-name]]].ziref
# File inside the folder : MyClass.py.ziref
class MyClass:
# Created folder : MyTableA
# Created file inside the folder : MyClass.py
class MyClass:
# Created folder : MyTableB
# Created file inside the folder : MyClass.py
class MyClass:
# Created folder : MyTableC
# Created file inside the folder : MyClass.py
class MyClass:
...
# Created folder : MyTableZ
# Created file inside the folder : MyClass.py
class MyClass:
Example 2
Assume that we use a database with tables : Table1, Table2, Table3, …, Table100 and each table has an id column and name column that has a name ending with its number.
Java
Input
// Folder : Your[[[zg-entity...zg-name]]]Folder.ziref
// File inside the folder : Your[[[zg-entity...zg-name]]]Class.java.ziref
public class Your[[[zg-entity...zg-name]]]Class {
// Columns :
zg-for(((zg-item:::[[[zg-entity...zg-fields]]]))){{{
// [[[zg-item...zg-name]]]
}}}
}
Output
// Created folder : YourTable1Folder
// Created file inside the folder : YourTable1Class.java
public class YourTable1Class {
// Columns :
// Id
// Name1
}
// Created folder : YourTable2Folder
// Created file inside the folder : YourTable2Class.java
public class YourTable2Class {
// Columns :
// Id
// Name2
}
// Created folder : YourTable3Folder
// Created file inside the folder : YourTable3Class.java
public class YourTable3Class {
// Columns :
// Id
// Name3
}
...
// Created folder : YourTable100Folder
// Created file inside the folder : YourTable100Class.java
public class YourTable100Class {
// Columns :
// Id
// Name100
}
C#
Input
// Folder : Your[[[zg-entity...zg-name]]]Folder.ziref
// File inside the folder : Your[[[zg-entity...zg-name]]]Class.cs.ziref
public class Your[[[zg-entity...zg-name]]]Class {
// Columns :
zg-for(((zg-item:::[[[zg-entity...zg-fields]]]))){{{
// [[[zg-item...zg-name]]]
}}}
}
Output
// Created folder : YourTable1Folder
// Created file inside the folder : YourTable1Class.cs
public class YourTable1Class {
// Columns :
// Id
// Name1
}
// Created folder : YourTable2Folder
// Created file inside the folder : YourTable2Class.cs
public class YourTable2Class {
// Columns :
// Id
// Name2
}
// Created folder : YourTable3Folder
// Created file inside the folder : YourTable3Class.cs
public class YourTable3Class {
// Columns :
// Id
// Name3
}
...
// Created folder : YourTable100Folder
// Created file inside the folder : YourTable100Class.cs
public class YourTable100Class {
// Columns :
// Id
// Name100
}
Python
# Your[[[zg-entity...zg-name]]]Class.py.zref
class Your[[[zg-entity...zg-name]]]Class:
# Columns :
zg-for(((zg-item:::[[[zg-entity...zg-fields]]]))){{{
# [[[zg-item...zg-name]]]
}}}
# YourTable1Class.py
class YourTable1Class:
# Columns :
# Id
# Name1
# YourTable2Class.py
class YourTable2Class:
# Columns :
# Id
# Name2
# YourTable3Class.py
class YourTable3Class:
# Columns :
# Id
# Name3
...
# YourTable100Class.py
class YourTable100Class:
# Columns :
# Id
# Name100
Built-in Functions
zg-upper converts string to upper case.
zg-lower converts string to lower case.
zg-upperFirstCase converts first character of a string to upper case.
zg-lowerFirstCase converts first character of a string to lower case.
zg-pluralize pluralize a name if it is in a single form.
zg-singularize singularize a name if it is in a plural form.
zg-convertToCSharpDataType converts data type of an entity to C# data type.
zg-convertToGoDataType converts data type of an entity to Go data type.
zg-convertToJavaDataType converts data type of an entity to Java data type.
zg-convertToJavascriptDataType converts data type of an entity to Javascript data type.
zg-convertToPHPDataType converts data type of an entity to PHP data type.
zg-convertToPythonDataType converts data type of an entity to Python data type.
zg-convertToRDataType converts data type of an entity to R data type.
zg-convertToSwiftDataType converts data type of an entity to Swift data type.
zg-convertToTypeScriptDataType converts data type of an entity to TypeScript data type.
zg-convertToVBNetDataType converts data type of an entity to VB.Net data type.
zg-convertToOtherDataType converts data type of an entity to Other Language data type defined by developer.
zg-convertToAnotherDataType converts data type of an entity to Another Language data type defined by developer.
zg-toStr returns a string representing the object.
Data Type Conversion
Data Type Conversion between data source and programming language is automatically done by Zontroy Generator.You can customize conversion by using Data Type Conversion tool window.
Sample : MySQL -> Java
Data Type |
Target Type |
Null Target Type |
Primitive Type |
Secondary Type |
nchar |
String |
|
|
|
nvarchar |
String |
|
|
|
int |
int |
|
|
|
smallint |
short |
|
|
|
... |
... |
|
|
|
Entity Token Definator
Entity Class structure may vary in each programming language and even each technology or framework.Therefore in Entity Token Definator tool window you can set regular expression spesific to entity classes in order to parse those classes.
Sample : Java
Token Type |
Regular Expression |
Base Entity |
public abstract class (?[^\s]+) |
Entity |
public(?s)(.*)class (?[^\s]+) { |
Field |
private (?[^\s]+) (?[^\s]+); |