### Build Integer List by Count (Start 1) Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/html/objects/fn.html Example usage of `$fn.buildIntValues` to create a list of a specified number of integers starting from 1, demonstrating iteration and access. ```Velocity #set ( $values = $fn.buildIntValues(5) ) ## 5 values from 1 to 5 Values size = $values.size() #foreach( $v in $values ) . value = $v #end #set($last = ( $values.size() - 1) ) #foreach ( $i in [0..$last] ) . value($i) = $values.get($i) #end ``` -------------------------------- ### Build Integer List by Count (Custom Start) Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/html/objects/fn.html Example usage of `$fn.buildIntValues` to create a list of a specified number of integers starting from a custom value, demonstrating iteration and access. ```Velocity #set ( $values = $fn.buildIntValues(10,0) ) ## 10 values from 0 to 9 Values size = $values.size() #foreach( $v in $values ) . value = $v #end #set($last = ( $values.size() - 1) ) #foreach ( $i in [0..$last] ) . value($i) = $values.get($i) #end ``` -------------------------------- ### Velocity Example: Get Telosys Templates Folder Full Path Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v420/objects/project.html Demonstrates how to retrieve the full file system path to the templates folder for the current Telosys project using `$project.templatesFolderFullPath`. ```Velocity $project.templatesFolderFullPath ``` -------------------------------- ### Build Integer List from Collection Size (Custom Start) Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/html/objects/fn.html Example usage of `$fn.buildIntValues` to create a list of integers starting from a specified value up to the size of a given collection, demonstrating iteration and access. ```Velocity #set ( $values = $fn.buildIntValues($entity.attributes, 0) ) Values size = $values.size() #foreach( $v in $values ) . value = $v #end #set($last = ( $values.size() - 1) ) #foreach ( $i in [0..$last] ) . value($i) = $values.get($i) #end ``` -------------------------------- ### Instantiate Telosys SQL Object for Database Schema Generation Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/objects/sql.html Demonstrates how to create a new instance of the `$sql` object using the `$factory.newSql()` method. It shows examples for getting predefined conventions for standard databases like 'PostgreSQL' and for using specific conventions from a custom properties file located within the template bundle. ```Apache Velocity ## Get predefined conventions for a standard database (eg 'PostgreSQL') ## Known databases names : 'SQL-ANSI', 'PostgreSQL', 'Oracle', 'SQLServer' ## Database name is not case sensitive #set( $sql = $factory.newSql('PostgreSQL') ) ## Get specific conventions using a specific file located in the bundle of templates #set( $sql = $factory.newSql('PostgreSQL', $fn.fileFromBundle('postgresql.properties') ) ) ``` -------------------------------- ### Build Integer List from Collection Size (Start 1) Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/html/objects/fn.html Example usage of `$fn.buildIntValues` to create a list of integers from 1 up to the size of a given collection, demonstrating iteration and access. ```Velocity #set ( $values = $fn.buildIntValues($entity.attributes) ) Values size = $values.size() #foreach( $v in $values ) . value = $v #end #set($last = ( $values.size() - 1) ) #foreach ( $i in [0..$last] ) . value($i) = $values.get($i) #end ``` -------------------------------- ### Velocity Example: Get Telosys Project Full Path Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v420/objects/project.html Shows how to retrieve the absolute file system path of the current Telosys project using the `$project.locationFullPath` attribute. ```Velocity $project.locationFullPath ``` -------------------------------- ### Java toStringMethod Usage Examples Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v400/objects/java.html Examples demonstrating how to invoke the `$java.toStringMethod` to generate Java `toString` methods using different parameter sets within the Telosys template language. ```Java $java.toStringMethod( $entity, $nonKeyAttributes, $embeddedIdName, 4 ) ``` ```Java $java.toStringMethod( $entity, 4 ) ``` ```Java $java.toStringMethod( $attributes, 4 ) ``` -------------------------------- ### Velocity Example: Get Telosys Models Folder Full Path Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v420/objects/project.html Illustrates how to obtain the full file system path to the models folder within the current Telosys project using `$project.modelsFolderFullPath`. ```Velocity $project.modelsFolderFullPath ``` -------------------------------- ### Telosys Example: Generate Link Annotations (2 parameters) Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/objects/jpa.html Example usage of the `$jpa.linkAnnotations` method in a Telosys template to generate JPA annotations for a link, formatted with a 4-space left margin. ```Telosys $jpa.linkAnnotations( 4, $link ) ``` -------------------------------- ### Telosys $project Object Attributes and Usage Examples Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/html/objects/project.html This section provides a detailed reference for the `$project` object in the Telosys generator, outlining its attributes for accessing project-specific information such as variables, configuration, and file system paths. Each attribute includes its type, purpose, and a Velocity code example demonstrating its usage. ```APIDOC $project Object Description: Current project with configuration parameters (variables, folders, ...) Since: 2.0.7 Attributes: allVariables : Variable[] Description: Returns all the variables available for the current project (the specific variables defined for the project and the standard variables). Since: 2.0.7 locationFullPath : String Description: Returns the current project location (full path). Since: 2.0.7 modelsFolderFullPath : String Description: Returns models folder (full path) for the current project. Since: 3.3.0 specificVariables : Variable[] Description: Returns the specific variables defined for the current project (the specific variables defined for the project and the standard variables). Since: 2.0.7 templatesFolderFullPath : String Description: Returns templates folder (full path) for the current project. Since: 3.0.0 ``` ```Velocity #foreach( $var in $project.allVariables ) $var.name = $var.value #end ``` ```Velocity $project.locationFullPath ``` ```Velocity $project.modelsFolderFullPath ``` ```Velocity #foreach( $var in $project.specificVariables ) $var.name = $var.value #end ``` ```Velocity $project.templatesFolderFullPath ``` -------------------------------- ### Telosys Template Example: Get HTML 'min' attribute Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v420/objects/html.html Demonstrates how to use the '$html.min' function within a Telosys template to retrieve the HTML5 'min' attribute for a given attribute in context. ```Telosys Template $html.min($attribute) ``` -------------------------------- ### C# Literal Value Examples by Type Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/html/languages/language-csharp.html This API documentation provides examples of literal values for various C# data types as generated by the system. It includes mappings from model types to their corresponding C# language types, full types, and illustrative literal value examples. ```APIDOC Model type | Language type | Language full type | Language literal value example -----------|---------------|--------------------|------------------------------ string | string | string | "AAA" string | String | System.String | "AAA" byte | sbyte | sbyte | 1 byte | byte | byte | 1 byte | SByte | System.SByte | 1 short | short | short | 1 short | ushort | ushort | 1 short | Int16 | System.Int16 | 1 int | int | int | 100 int | uint | uint | 100 int | Int32 | System.Int32 | 100 long | long | long | 1000L long | ulong | ulong | 1000L long | Int64 | System.Int64 | 1000L decimal | decimal | decimal | 10000.77M decimal | Decimal | System.Decimal | 10000.77M float | float | float | 1000.5F float | Single | System.Single | 1000.5F double | double | double | 1000.66D double | Double | System.Double | 1000.66D boolean | bool | bool | true boolean | Boolean | System.Boolean | true date | DateTime | System.DateTime | null time | DateTime | System.DateTime | null timestamp | DateTime | System.DateTime | null binary | byte[] | byte[] | null ``` -------------------------------- ### Velocity Example: Iterate Specific Telosys Project Variables Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v420/objects/project.html Provides a Velocity Template Language example to iterate through only the specific variables defined for the current Telosys project using `$project.specificVariables` and display their names and values. ```Velocity #foreach( $var in $project.specificVariables ) $var.name = $var.value #end ``` -------------------------------- ### Telosys Template Example: Generate H2 CREATE TABLE DDL Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v330/objects/h2.html Demonstrates how to use the `ddlCreateTable` method of the H2 object within a Telosys template. This example generates the 'CREATE TABLE' DDL statement for a specified entity. ```Telosys Template $h2.ddlCreateTable($entity) ``` -------------------------------- ### Telosys Template Example: Generate CREATE TABLE DDL Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/objects/h2.html An example demonstrating how to call the `ddlCreateTable` method on the H2 database object within a Telosys template to generate a 'CREATE TABLE' DDL statement for a given entity. ```Telosys Template $h2.ddlCreateTable($entity) ``` -------------------------------- ### Telosys C# Literal Value Examples Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v400/languages/language-csharp.html This table provides examples of how Telosys generates literal values for different model types, showing the corresponding C# language type, full type, and an example literal value. ```APIDOC Model type | Language type | Language full type | Language literal value example -----------|---------------|--------------------|------------------------------- string | string | string | "AAA" string | String | System.String | "AAA" byte | sbyte | sbyte | 1 byte | byte | byte | 1 byte | SByte | System.SByte | 1 short | short | short | 1 short | ushort | ushort | 1 short | Int16 | System.Int16 | 1 int | int | int | 100 int | uint | uint | 100 int | Int32 | System.Int32 | 100 long | long | long | 1000L long | ulong | ulong | 1000L long | Int64 | System.Int64 | 1000L decimal | decimal | decimal | 10000.77M decimal | Decimal | System.Decimal | 10000.77M float | float | float | 1000.5F float | Single | System.Single | 1000.5F double | double | double | 1000.66D double | Double | System.Double | 1000.66D boolean | bool | bool | true boolean | Boolean | System.Boolean | true date | DateTime | System.DateTime | null time | DateTime | System.DateTime | null timestamp | DateTime | System.DateTime | null binary | byte[] | byte[] | null ``` -------------------------------- ### buildIntValues(int count, int startValue) API Reference Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v330/objects/fn.html Builds a list of N consecutive integer values, starting from a specified initial value. Both the number of values (N) and the starting value are provided as integer parameters. This offers full control over the length and starting point of the generated sequence. ```APIDOC $fn.buildIntValues(int count, int startValue): List count: int - the number of values to be created startValue: int - the first value of the list Example: #set ( $values = $fn.buildIntValues(10,0) ) ## 10 values from 0 to 9 Values size = $values.size() #foreach( $v in $values ) . value = $v #end #set($last = ( $values.size() - 1) ) #foreach ( $i in [0..$last] ) . value($i) = $values.get($i) #end Since: 3.0.0 ``` -------------------------------- ### Telosys Go Literal Value Examples by Model Type Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v330/languages/language-go.html This table provides examples of literal values generated for various model types in Go, showing the mapping from model type to Go language type, full type, and an example literal value. ```APIDOC Model type | Language type | Language full type | Language literal value example -----------|---------------|--------------------|------------------------------- string | string | string | "AAA" byte | byte | byte | 1 byte | uint8 | uint8 | 1 short | int16 | int16 | 1 short | uint16 | uint16 | 1 int | int32 | int32 | 100 int | uint32 | uint32 | 100 long | int64 | int64 | 1000 long | uint64 | uint64 | 1000 decimal | float64 | float64 | 10000.77 float | float32 | float32 | 1000.5 double | float64 | float64 | 1000.66 boolean | bool | bool | true date | time.Time | time.Time | nil time | time.Time | time.Time | nil timestamp | time.Time | time.Time | nil binary | []byte | []byte | nil ``` -------------------------------- ### Creating and Using Telosys File Object Instances Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/objects/file.html Illustrates how to obtain a file object instance from various sources (direct path, bundle, model) and demonstrates basic usage, including checking file properties (`exists()`, `isFile()`) and loading content (`loadContent()`, `loadLines()`). ```Velocity ## Get file instance : #set( $file = $fn.file('dir/foo.txt') ) #set( $file = $fn.fileFromBundle("foo.txt") ) #set( $file = $fn.fileFromModel('myfile.csv') ) ## Use file instance : #if( $file.exists() && $file.isFile() ) #set($content = $file.loadContent() ) #end #foreach ( $line in $file.loadLines() ) > $line #end ``` -------------------------------- ### Telosys Go Literal Value Examples by Model Type Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/html/languages/language-go.html This table provides concrete examples of how various model types are translated into their corresponding Go language types and their literal representations when generated by Telosys. ```APIDOC Model type | Language type | Language full type | Language literal value example -----------|---------------|--------------------|-------------------------------- string | string | string | "AAA" byte | byte | byte | 1 byte | uint8 | uint8 | 1 short | int16 | int16 | 1 short | uint16 | uint16 | 1 int | int32 | int32 | 100 int | uint32 | uint32 | 100 long | int64 | int64 | 1000 long | uint64 | uint64 | 1000 decimal | float64 | float64 | 10000.77 float | float32 | float32 | 1000.5 double | float64 | float64 | 1000.66 boolean | bool | bool | true date | time.Time | time.Time | nil time | time.Time | time.Time | nil timestamp | time.Time | time.Time | nil binary | []byte | []byte | nil ``` -------------------------------- ### Telosys Example: Generate Entity Annotations Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/objects/jpa.html Example usage of the `$jpa.entityAnnotations` method in a Telosys template to generate all required JPA annotations for an entity, formatted with a 4-space left margin. ```Telosys $jpa.entityAnnotations(4, $entity) ``` -------------------------------- ### Telosys PHP Literal Value Examples by Model Type Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v420/languages/language-php.html Provides examples of how Telosys generates literal values in PHP for various model types, showing the corresponding language type, full type, and an example literal value. ```APIDOC Model Type | Language Type | Language Full Type | Language Literal Value Example string | ?string | ?string | "AAA" string | string | string | "AAA" byte | ?int | ?int | 1 byte | int | int | 1 short | ?int | ?int | 1 short | int | int | 1 int | ?int | ?int | 100 int | int | int | 100 long | ?int | ?int | 1000 long | int | int | 1000 decimal | ?float | ?float | 10000.77 decimal | float | float | 10000.77 float | ?float | ?float | 1000.5 float | float | float | 1000.5 double | ?float | ?float | 1000.66 double | float | float | 1000.66 boolean | ?bool | ?bool | true boolean | bool | bool | true date | ?DateTime | ?DateTime | null date | DateTime | DateTime | null time | ?DateTime | ?DateTime | null time | DateTime | DateTime | null timestamp | ?DateTime | ?DateTime | null timestamp | DateTime | DateTime | null binary | null | null | null ``` -------------------------------- ### Get Target Language Type of Attribute Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/objects/attribute.html Returns the target language type for the attribute. Examples for Java include 'int', 'BigDecimal', 'LocalDate'. Examples for Golang include 'string', 'int32', 'float32'. ```APIDOC type: String ``` -------------------------------- ### Initialize and Use Telosys $file Object Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v400/objects/file.html Demonstrates how to create an instance of the `$file` object using various factory methods (`$fn.file`, `$fn.fileFromBundle`, `$fn.fileFromModel`) and then perform basic operations like checking existence, file type, loading content as a single string, and iterating through lines. ```Velocity ## Get file instance : #set( $file = $fn.file('dir/foo.txt') ) #set( $file = $fn.fileFromBundle("foo.txt") ) #set( $file = $fn.fileFromModel('myfile.csv') ) ## Use file instance : #if( $file.exists() && $file.isFile() ) #set($content = $file.loadContent() ) #end #foreach ( $line in $file.loadLines() ) > $line #end ``` -------------------------------- ### Creating and Using File Instances in Telosys Velocity Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v420/objects/file.html This snippet demonstrates how to obtain a file instance using various methods provided by the '$fn' utility, such as '$fn.file()', '$fn.fileFromBundle()', and '$fn.fileFromModel()'. It then illustrates basic file operations like checking for existence, verifying if it's a file, loading its entire content as a string, and iterating over its lines. ```Velocity ## Get file instance : #set( $file = $fn.file('dir/foo.txt') ) #set( $file = $fn.fileFromBundle("foo.txt") ) #set( $file = $fn.fileFromModel('myfile.csv') ) ## Use file instance : #if( $file.exists() && $file.isFile() ) #set($content = $file.loadContent() ) #end #foreach ( $line in $file.loadLines() ) > $line #end ``` -------------------------------- ### Telosys Generator $now Object API Reference and Usage Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v420/objects/now.html This snippet provides the API documentation for the `$now` object available in Telosys Generator. It details the attributes and methods used to access and format the current system date and time, including examples for each usage. ```APIDOC $now Object: Description: Object providing the current system date and time in different formats Since: 3.3.0 Attributes and Methods: .date: Type: String Description: Returns the current date with the default format 'yyyy-MM-dd' Example Value: '2019-07-14' .datetime: Type: String Description: Returns the current date and time with the default format 'yyyy-MM-dd HH:mm:ss' Example Value: '2019-07-14 14:55:34' .format(format: String): Returns: String Description: Returns the current date/time formatted with the given format Parameters: format: Type: String Description: the desired format .time: Type: String Description: Returns the current time with the default format 'HH:mm:ss' Example Value: '14:55:34' ``` ```Telosys Template $now.date ``` ```Telosys Template $now.datetime ``` ```Telosys Template $now.format('yyyy-MM') ``` ```Telosys Template $now.time ``` -------------------------------- ### Get Attribute Simple Type Name Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/objects/attribute.html Returns the simple type name of the attribute. For Java objects, examples include 'BigDecimal', 'Date', 'Integer'. For Java primitive types, examples include 'short', 'int'. ```APIDOC simpleType: String ``` -------------------------------- ### Get Current Date with Default Format ($now.date) Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/objects/now.html Returns the current date using the default 'yyyy-MM-dd' format. For example, '2019-07-14'. ```APIDOC $now.date : String ``` ```Telosys Template $now.date ``` -------------------------------- ### $factory Class API Reference Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v400/objects/factory.html Detailed API documentation for the `$factory` class, outlining its methods, parameters, and return types for various object instantiation and utility functions. ```APIDOC $factory: newBigDecimal(value: Double): BigDecimal value: The value to be converted in BigDecimal newBigDecimal(value: Integer): BigDecimal value: The value to be converted in BigDecimal newBigDecimal(value: String): BigDecimal value: The value to be converted in BigDecimal newBigInteger(value: Integer): BigInteger value: The value to be converted in BigInteger newBigInteger(value: String): BigInteger value: The value to be converted in BigInteger newJdbc(entity: EntityInContext): JdbcInContext entity: The entity to be used (to create CRUD SQL requests, mapping, etc) newSql(targetDbName: String): SqlInContext targetDbName: Target database name (not case sensitive, e.g., 'PostgreSQL') newSql(targetDbName: String, targetDbConfigFile: FileInContext): SqlInContext targetDbName: Target database name ('postgresql', 'mysql', etc.) targetDbConfigFile: Target database configuration file ``` -------------------------------- ### Telosys Model Type to C# Literal Value Examples Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/languages/language-csharp.html This documentation provides examples of literal values generated in C# for various Telosys model types. It illustrates the mapping from model type to C# language type, full type, and a representative literal value. ```APIDOC Telosys Model Type to C# Literal Value Examples: Model type Language type Language full type Language literal value example string string? string? "AAA" string string string "AAA" string String? System.String? "AAA" byte sbyte? sbyte? 1 byte byte? byte? 1 byte sbyte sbyte 1 byte SByte? System.SByte? 1 short short? short? 1 short ushort? ushort? 1 short short short 1 short Int16? System.Int16? 1 int int? int? 100 int uint? uint? 100 int int int 100 int Int32? System.Int32? 100 long long? long? 1000L long ulong? ulong? 1000L long long long 1000L long Int64? System.Int64? 1000L decimal decimal? decimal? 10000.77M decimal decimal decimal 10000.77M decimal Decimal? System.Decimal? 10000.77M float float? float? 1000.5F float float float 1000.5F float Single? System.Single? 1000.5F double double? double? 1000.66D double double double 1000.66D double Double? System.Double? 1000.66D boolean bool? bool? true boolean bool bool true boolean Boolean? System.Boolean? true date DateOnly? System.DateOnly? null date DateOnly System.DateOnly null time TimeOnly? System.TimeOnly? null time TimeOnly System.TimeOnly null timestamp DateTime? System.DateTime? null timestamp DateTime System.DateTime null binary byte[]? byte[]? null binary byte[] byte[] null ``` -------------------------------- ### Telosys C# Literal Value Examples by Model Type Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v330/languages/language-csharp.html This API documentation provides examples of C# literal values generated by Telosys for various model types, showing the corresponding language type and full language type. These examples illustrate how Telosys translates model data into C# code literals. ```APIDOC Telosys C# Literal Value Examples: Model Type | Language Type | Language Full Type | Language Literal Value Example -----------|---------------|--------------------|------------------------------- string | string | string | "AAA" string | String | System.String | "AAA" byte | sbyte | sbyte | 1 byte | byte | byte | 1 byte | SByte | System.SByte | 1 short | short | short | 1 short | ushort | ushort | 1 short | Int16 | System.Int16 | 1 int | int | int | 100 int | uint | uint | 100 int | Int32 | System.Int32 | 100 long | long | long | 1000L long | ulong | ulong | 1000L long | Int64 | System.Int64 | 1000L decimal | decimal | decimal | 10000.77M decimal | Decimal | System.Decimal | 10000.77M float | float | float | 1000.5F float | Single | System.Single | 1000.5F double | double | double | 1000.66D double | Double | System.Double | 1000.66D boolean | bool | bool | true boolean | Boolean | System.Boolean | true date | DateTime | System.DateTime | null time | DateTime | System.DateTime | null timestamp | DateTime | System.DateTime | null binary | byte[] | byte[] | null ``` -------------------------------- ### C# Literal Value Examples by Model Type Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v420/languages/language-csharp.html This table illustrates examples of literal values in C# for various model types, showing their corresponding C# language types, full types, and example literal representations. This helps understand how data is represented in the generated C# code. ```APIDOC Model type Language type Language full type Language literal value example string string? string? "AAA" string string string "AAA" string String? System.String? "AAA" byte sbyte? sbyte? 1 byte byte? byte? 1 byte sbyte sbyte 1 byte SByte? System.SByte? 1 short short? short? 1 short ushort? ushort? 1 short short short 1 short Int16? System.Int16? 1 int int? int? 100 int uint? uint? 100 int int int 100 int Int32? System.Int32? 100 long long? long? 1000L long ulong? ulong? 1000L long long long 1000L long Int64? System.Int64? 1000L decimal decimal? decimal? 10000.77M decimal decimal decimal 10000.77M decimal Decimal? System.Decimal? 10000.77M float float? float? 1000.5F float float float 1000.5F float Single? System.Single? 1000.5F double double? double? 1000.66D double double double 1000.66D double Double? System.Double? 1000.66D boolean bool? bool? true boolean bool bool true boolean Boolean? System.Boolean? true date DateOnly? System.DateOnly? null date DateOnly System.DateOnly null time TimeOnly? System.TimeOnly? null time TimeOnly System.TimeOnly null timestamp DateTime? System.DateTime? null timestamp DateTime System.DateTime null binary byte[]? byte[]? null binary byte[] byte[] null ``` -------------------------------- ### Get Attribute Setter Method Name Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/objects/attribute.html Returns the setter method name for the attribute. For example, 'setFoo' for an attribute named 'foo'. ```APIDOC setter: String ``` -------------------------------- ### Velocity Example: Iterate All Telosys Project Variables Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v420/objects/project.html Demonstrates how to use Velocity Template Language to iterate through all variables (specific and standard) available in the current Telosys project via `$project.allVariables` and print their names and values. ```Velocity #foreach( $var in $project.allVariables ) $var.name = $var.value #end ``` -------------------------------- ### Get Java setter name Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v420/objects/link.html Returns the conventional Java setter method name for the link, for example, 'setPerson' for a link named 'person'. ```APIDOC .setter : String ``` -------------------------------- ### Initialize Telosys SQL Object for Database Schema Generation Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v400/objects/sql.html This snippet demonstrates how to obtain an instance of the $sql object in Telosys. It shows two ways: getting predefined conventions for a standard database like 'PostgreSQL', or loading specific conventions from a properties file within the template bundle. This object is essential for generating database DDL commands. ```Velocity ## Get predefined conventions for a standard database (eg 'PostgreSQL') ## Known databases names : 'SQL-ANSI', 'PostgreSQL', 'Oracle', 'SQLServer' ## Database name is not case sensitive #set( $sql = $factory.newSql('PostgreSQL') ) ## Get specific conventions using a specific file located in the bundle of templates #set( $sql = $factory.newSql('PostgreSQL', $fn.fileFromBundle('postgresql.properties') ) ) ``` -------------------------------- ### Build Integer List from Collection Size with Start Value (Telosys) Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/objects/fn.html Generates a list of N consecutive integer values, starting from a specified 'firstValue', where N is determined by the size of the provided collection. Useful for iteration or indexing with a custom starting point. ```APIDOC buildIntValues(collection: Collection, firstValue: int): List collection: the collection determining the number of values (collection size) firstValue: the first value of the list ``` ```Velocity #set ( $values = $fn.buildIntValues($entity.attributes, 0) ) Values size = $values.size() #foreach( $v in $values ) . value = $v #end #set($last = ( $values.size() - 1) ) #foreach ( $i in [0..$last] ) . value($i) = $values.get($i) #end ``` -------------------------------- ### Get Current Time with Default Format ($now.time) Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/objects/now.html Returns the current time using the default 'HH:mm:ss' format. For example, '14:55:34'. ```APIDOC $now.time : String ``` ```Telosys Template $now.time ``` -------------------------------- ### Create SQL tool object with custom DB config using Telosys $factory Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v420/objects/factory.html Creates a new instance of the SQL tool object using a specific database definition file for the given target database name. The 'targetDbName' parameter is the target database name (e.g., 'postgresql', 'mysql'), and 'targetDbConfigFile' is the path to the database configuration file. This method returns a SqlInContext object. ```APIDOC $factory.newSql(String targetDbName, FileInContext targetDbConfigFile): SqlInContext targetDbName: Target database name ('postgresql', 'mysql', etc ) targetDbConfigFile: Target database configuration file ``` ```Velocity #set( $sql = $factory.newSql('PostgreSQL', $fn.fileFromBundle('postgresql.properties') ) ) ``` -------------------------------- ### Telosys Model Type to C++ Literal Value Examples Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v420/languages/language-c++.html This API documentation table provides examples of C++ literal values generated by Telosys for various model types. It illustrates the corresponding C++ language type, full type, and an example of the generated literal value. ```APIDOC Model type | Language type | Language full type | Language literal value example -----------|---------------|--------------------|------------------------------ string | string | string | "AAA" byte | char | char | 1 byte | unsigned char | unsigned char | 1 short | short | short | 1 short | unsigned short| unsigned short | 1 int | int | int | 100 int | unsigned int | unsigned int | 100 long | long | long | 1000 long | unsigned long | unsigned long | 1000 decimal | double | double | 10000.77 float | float | float | 1000.5 double | double | double | 1000.66 boolean | bool | bool | true date | std::tm | std::tm | NULL time | std::time_t | std::time_t | NULL timestamp | std::tm | std::tm | NULL binary | std::vector | std::vector | NULL ``` -------------------------------- ### Get Neutral Type of Attribute Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/objects/attribute.html Returns the 'neutral type' of the attribute as defined in the model. Examples include 'string', 'short', 'decimal', 'boolean', 'date', 'time'. ```APIDOC neutralType: String ``` -------------------------------- ### Create SQL Tool Instances with $factory (Velocity) Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v400/objects/factory.html Demonstrates how to create `SqlInContext` objects using the `$factory` utility in Telosys Velocity templates. This allows for generating SQL based on a target database name, optionally using a specific configuration file for advanced scenarios. ```Velocity #set( $sql = $factory.newSql('PostgreSQL') ) ``` ```Velocity #set( $sql = $factory.newSql('PostgreSQL', $fn.fileFromBundle('postgresql.properties') ) ) ``` -------------------------------- ### Detailed Java Literal Value Examples by Model Type Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/html/languages/language-java.html Provides comprehensive examples illustrating how various generic model types are converted to their corresponding Java language types, full types, and their specific literal value representations in Java. This table serves as a reference for understanding the generated code's data type and value formatting. ```APIDOC Detailed Java Literal Value Examples: Model Type | Language Type | Language Full Type | Language Literal Value Example -----------|---------------|------------------------|-------------------------------- string | String | java.lang.String | "AAA" byte | Byte | java.lang.Byte | Byte.valueOf((byte)1) byte | byte | byte | (byte)1 short | Short | java.lang.Short | Short.valueOf((short)1) short | short | short | (short)1 int | Integer | java.lang.Integer | Integer.valueOf(100) int | int | int | 100 long | Long | java.lang.Long | Long.valueOf(1000L) long | long | long | 1000L decimal | BigDecimal | java.math.BigDecimal | java.math.BigDecimal.valueOf(10000.77) float | Float | java.lang.Float | Float.valueOf(1000.5F) float | float | float | 1000.5F double | Double | java.lang.Double | Double.valueOf(1000.66D) double | double | double | 1000.66D boolean | Boolean | java.lang.Boolean | Boolean.valueOf(true) boolean | boolean | boolean | true date | Date | java.util.Date | java.sql.Date.valueOf("2001-06-22") time | Date | java.util.Date | java.sql.Time.valueOf("01:46:52") timestamp | Date | java.util.Date | java.sql.Timestamp.valueOf("2001-05-21 01:46:52") binary | byte[] | byte[] | null ``` -------------------------------- ### Get SQL Column Constraints for Attribute Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/objects/attribute.html Returns the SQL column constraints for the attribute. For example: 'NOT NULL DEFAULT 12'. Available since version 3.4.0. ```APIDOC sqlColumnConstraints: String ``` -------------------------------- ### Get Java setter name Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/objects/link.html Returns the conventional Java setter method name for the link. For example, for a link named 'person', it would return 'setPerson'. ```APIDOC setter : String ``` -------------------------------- ### Get Current Date and Time with Default Format ($now.datetime) Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/objects/now.html Returns the current date and time using the default 'yyyy-MM-dd HH:mm:ss' format. For example, '2019-07-14 14:55:34'. ```APIDOC $now.datetime : String ``` ```Telosys Template $now.datetime ``` -------------------------------- ### Initialize and Use Telosys $file Object Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v330/objects/file.html This snippet demonstrates how to obtain an instance of the `$file` object using various factory methods like `$fn.file()`, `$fn.fileFromBundle()`, and `$fn.fileFromModel()`. It then shows basic usage, including checking file existence and type, loading content into a string, and iterating over file lines. ```Velocity ## Get file instance : #set( $file = $fn.file('dir/foo.txt') ) #set( $file = $fn.fileFromBundle("foo.txt") ) #set( $file = $fn.fileFromModel('myfile.csv') ) ## Use file instance : #if( $file.exists() && $file.isFile() ) #set($content = $file.loadContent() ) #end #foreach ( $line in $file.loadLines() ) > $line #end ``` -------------------------------- ### Telosys Example: Generate Link Cardinality Annotation Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/objects/jpa.html Example usage of the `$jpa.linkCardinalityAnnotation` method in a Telosys template to generate the JPA cardinality annotation for a link, formatted with a 4-space left margin. ```Telosys $jpa.linkCardinalityAnnotation( 4, $link ) ``` -------------------------------- ### Get Wrapper Type for Primitive Attribute Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/objects/attribute.html Returns the wrapper type corresponding to the attribute's primitive type. Examples include 'Float' for 'float', 'Integer' for 'int', 'Boolean' for 'boolean'. ```APIDOC wrapperType: String ``` -------------------------------- ### Create SQL tool object with default DB using Telosys $factory Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v420/objects/factory.html Creates a new instance of the SQL tool object using the default database definition (if any) for the specified target database name. The 'targetDbName' parameter is the name of the target database (not case sensitive, e.g., 'PostgreSQL'). This method returns a SqlInContext object. ```APIDOC $factory.newSql(String targetDbName): SqlInContext targetDbName: Target database name (not case sensitive, eg 'PostgreSQL') ``` ```Velocity #set( $sql = $factory.newSql('PostgreSQL') ) ``` -------------------------------- ### $loader Object API Reference Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v400/objects/loader.html Detailed API documentation for the $loader object, including its attributes and methods for class loading and instantiation within Telosys Velocity templates. ```APIDOC $loader: Special object used as a specific class loader by the Telosys generator. Description: Can be used to load a specific Java Class tool in the Velocity Context, allowing users to create and use their own classes in templates. Since: 2.0.3 Attributes: .classesFolder: String Description: Returns the full file path of the folder where specific classes are searched by the loader. Since: 2.0.5 .libFolder: String Description: Returns the full file path of the folder where specific libraries (jar) are searched by the loader. Since: 3.0.0 .uRLs: URL[] Description: Returns an array containing all the URLs used by the class loader. Since: 3.0.0 Methods: .loadClass(String javaClassName): Class Description: Loads the given Java class and returns it (no instance created). It can be a standard Java class (JDK) or a specific class. Specific classes must be located in the 'classes' folder (in the templates bundle) or in a jar located in the 'lib' folder (in the templates bundle). Parameters: javaClassName: String - The name of the Java class to be loaded. Since: 2.1.0 .newInstance(String javaClassName): Object Description: Loads the given Java class, creates a new instance, and returns it. It can be a standard Java class (JDK) or a specific class. The Java class must have a default constructor (in order to be created by 'javaClass.newInstance()'). Parameters: javaClassName: String - The name of the Java class to be loaded and used to create the instance. Since: 2.1.0 ``` -------------------------------- ### Generate Java toStringMethod with Tabs Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/objects/java.html Returns a string containing all the code for a Java 'toString()' method. Generates a 'toString' method using the given attributes (except non-printable attributes) and indents with TABS (1 tab for each indentation level). Note: The example provided in the source uses '$csharp' but refers to a Java method. Example usage: `$csharp.toStringMethod( $entity, $attributes, 2 )`. ```APIDOC toStringMethod(EntityInContext entity, List attributes, int indentationLevel) : String entity: The entity for which to generate the 'toString' method attributes: List of attributes to be used in the 'toString' method indentationLevel: Initial indentation level ``` -------------------------------- ### Telosys Example: Iterate Over JPA Imports Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v410/objects/jpa.html Example of using a `#foreach` loop in a Telosys template to iterate over the list of JPA import statements returned by `$jpa.imports` and generate corresponding Java import declarations. ```Telosys #foreach( $import in $jpa.imports($entity) ) import $import; #end ``` -------------------------------- ### Telosys Java Literal Value Examples by Model Type Source: https://github.com/telosys-tools-bricks/telosys-doc/blob/master/doc/v330/languages/language-java.html Illustrates how Telosys generates literal values for various model types in Java, showing the corresponding language type, full type, and an example of the generated literal value. ```APIDOC Model type | Language type | Language full type | Language literal value example -----------|---------------|--------------------|------------------------------- string | String | java.lang.String | "AAA" byte | Byte | java.lang.Byte | Byte.valueOf((byte)1) byte | byte | byte | (byte)1 short | Short | java.lang.Short | Short.valueOf((short)1) short | short | short | (short)1 int | Integer | java.lang.Integer | Integer.valueOf(100) int | int | int | 100 long | Long | java.lang.Long | Long.valueOf(1000L) long | long | long | 1000L decimal | BigDecimal | java.math.BigDecimal | java.math.BigDecimal.valueOf(10000.77) float | Float | java.lang.Float | Float.valueOf(1000.5F) float | float | float | 1000.5F double | Double | java.lang.Double | Double.valueOf(1000.66D) double | double | double | 1000.66D boolean | Boolean | java.lang.Boolean | Boolean.valueOf(true) boolean | boolean | boolean | true date | Date | java.util.Date | java.sql.Date.valueOf("2001-06-22") time | Date | java.util.Date | java.sql.Time.valueOf("01:46:52") timestamp | Date | java.util.Date | java.sql.Timestamp.valueOf("2001-05-21 01:46:52") binary | byte[] | byte[] | null ```